Code Scrappers


Add Two Numbers Without Using Arithmatic Operators - C program


              #include<stdio.h>
              #include<stdlib.h>

              int add(int, int);

              void main()
              {
                 int x, y;

                 printf("\n enter first number : ");

                 scanf("%d", &x);

                 printf("\n enter second number : ");

                 scanf("%d", &y);

                 printf("\n addition of two numbers is : %d", add(x, y));

              }

              int add(int n1, int n2)
              {
                 int i;

                 for (i = 0; i < n2; i++)
                 {
                    n1++;
                 }

                 return n1;
              }


          



Output


    enter first number : 4

    enter second number : 2

    addition of two numbers is : 6