Add without '+'

View previous topic View next topic Go down

Add without '+'

Post by Admin on Sat Jun 27, 2015 11:20 pm

Write a program to add two number without using the addition operator.

I/P: 5 10

O/P: 15

Admin
Admin

Posts : 22
Points : 5543
Join date : 2015-06-24
Age : 23

http://csenpsb.createforum.in

Back to top Go down

Re: Add without '+'

Post by vinoveera on Mon Jun 29, 2015 12:32 am

#include<stdio.h>
int main()
{
  int num1 = 10, num2 = 5, i;
   while (num2 > 0) {
     num1++;
     num2--;
 }
  printf("%d", num1);
  return (0);
}

vinoveera

Posts : 7
Points : 5493
Join date : 2015-06-27

Back to top Go down

Re: Add without '+'

Post by Admin on Mon Jun 29, 2015 6:15 pm

vinoveera wrote:#include<stdio.h>
int main()
{
  int num1 = 10, num2 = 5, i;
   while (num2 > 0) {
     num1++;
     num2--;
 }
  printf("%d", num1);
  return (0);
}

Your program is fine. Superb thinking. Keep it up.

Admin
Admin

Posts : 22
Points : 5543
Join date : 2015-06-24
Age : 23

http://csenpsb.createforum.in

Back to top Go down

Re: Add without '+'

Post by sreenivas_srevs on Sat Jul 04, 2015 7:28 pm

We can use functions right?

sreenivas_srevs

Posts : 3
Points : 5484
Join date : 2015-06-26

Back to top Go down

Re: Add without '+'

Post by Admin on Sat Jul 04, 2015 9:01 pm

sreenivas_srevs wrote:We can use functions right?

what kind of function you will use??

Admin
Admin

Posts : 22
Points : 5543
Join date : 2015-06-24
Age : 23

http://csenpsb.createforum.in

Back to top Go down

Re: Add without '+'

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum