Sum of Two Numbers in C | Sum of Two Variables in C

Program: Sum of Two Numbers in C
Sum of two variables in C programs:
 int main()
  int var1;
  int var2;
  int var3;
  printf("Type the first value 
var1 = ");
  printf("Type the second value 
var2 = ");
  var3 =var2+var1;
   printf("var3 =  %d",var3);
  return 0;
Type the first value var1 = 7
Type the second value var2 = 3
var3 = 10

  •  First three integers variables var1, var2, var3 are declared.
  • The values of var1, var2 are entered from keyword by the user.
  • The addition of two variables values var1, var2 are stored in var3.
    Sum of Two variables in C
  • In the last printf prints the value of var3.
See also:

Our Services

Search This Blog

  • ()
Powered by Blogger.

C Variables and Types of Variables in C

C variable is a data name that may be used to store a data value. The value of the C variable may get change in the program and it can be r...

Blog Archive