Answers for "combine two number without adding them in c"

C
1

Write a c program to add two numbers without using addition operator.

#include <stdio.h>
#include <stdlib.h>
int main()
{
    int num1,num2,i;  //Variable declaration
    printf("Enter the first number: ");
    scanf("%d",&num1); 
    printf("Enter the second number: ");
    scanf("%d",&num2);
    for(i=0; i<num2; i++){
   num1++;
    }
printf("Sum of two numbers : %d ",num1);
    return 0;
}
Posted by: Guest on March-06-2022
0

add 2 numbers in c

#include <stdio.h>

int addNumbers(int a, int b)
{
    int sum = a + b;
    return sum;
}

int main(void)
{
    int a = 4;
    int b = 7;

    printf(addNumbers(a,b));
    return 0;
}
Posted by: Guest on April-01-2022

Code answers related to "C"

Browse Popular Code Answers by Language