Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

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;
}
Source by inlarn.com #
 
PREVIOUS NEXT
Tagged: #Write #program #add #numbers #addition
ADD COMMENT
Topic
Name
6+1 =