C Program to add two numbers

In this program, You will learn how to add two numbers in c.


30 = 20 + 10

40 = 20 + 20

Example: How to add two numbers in c.

#include<stdio.h>

int main() {

   int x, y, z;

   printf("Enter two numbers :");
   scanf("%d%d", &x, &y);

   z = x + y;
   printf("Sum is :%d", z);

   return 0;
}

Output:

Enter two numbers :10 20                                                                                                               
Sum is :30