Pages

Friday 28 October 2011

write a prog to substact any two no. in c or c++ but without using any operator (+,-,/,*, etc.) ???

hit 4 u :-use

ASCII

5 comments:

  1. मेरा खयाल है कि मैंने इसे बनाया था, आपको दिखाया भी होगा…

    ReplyDelete
  2. तब ठीक है। मेरे पास है इसके लिए प्रोग्राम…देखता हूँ…शायद आपके ही कहने पर बनाया था…

    ReplyDelete
  3. यह प्रोग्राम बिना - का चिन्ह इस्तेमाल किए घटा सकता है। लेकिन इसमें एक जगह + का इस्तेमाल किया गया है। उम्मीद है कि आप इसमें थोड़ा सा आगे बढ़ के अपने मन जैसा बना सकते हैं…शायद आसान ही है

    #include
    #include
    #include
    #include
    main()
    {
    int neg,res;
    char min[6]={NULL},num1[5],num2[5];
    clrscr();
    min[0]=45;
    printf("\n Enter the first number:");
    scanf("%s",&num1);
    printf("Enter the second number:");
    scanf("%s",&num2);
    strcat(min,num2);
    neg=atoi(min);
    res=atoi(num1)+neg;
    printf("\n The result is %d.",res);
    getch();
    }

    ReplyDelete
  4. but you are using + operator in the line
    res=atoi(num1)+neg;

    ReplyDelete