3. Write a C program to input two no and print the sum without using third variable

void main()
{
int a,b;      // variable declaration
printf("Enter two nos.");     // message to enter no.
scanf("%d%d",&a,&b);    // store no in separate variable a and b
printf("Sum=%d",a+b);  // add variable and also print with message
getch();                          // waits untill any key is pressed.
}

Input:   10  15
Output:  Sum=25

Related Posts:

  • C Operator : C Programming C Programming C Operators An operator is the symbol that take one or more than one operand and perform operation on it. Ex.   int a,b, c;      a=10,b=20;       c=a+b;&n… Read More
  • Simple if Statement : C Programming                  C Programming Simple if Statement The statement which executes on the basis of certain condition is called simple if statement… Read More
  • If else : C Programming C Programming if else If we want to execute the particular statement on the basis of certain condition, called if else statement. Syntax     if(condition) { //body to execute } else { //body to execu… Read More
  • Constants in C : C Programming C Programming Constants in C A constant variable is such type of variable that's value can't be changed during execution of the program. Constants in C ConstantExample Decimal Constant10, 20, 450 etc. Real or Floating-p… Read More
  • Control Statement : C Programming C Programming Control Statement The statement which control the flow of control is called control statement.    C Provides following types of control statement- 1. Selective Statement or Conditional Statement. … Read More