Thursday, 21 August 2014

Filled Under: ,

C program to add two numbers

Share

C program to add two numbers:In c we can perform all types of mathematical operation like addition,subtraction,multiplication, division etc.Here a program is given below which add two number.It takes two number as input and after execution it print the sum of these number.

C program to add two numbers

#include<stdio.h>
int main()
{
 int a, b, res;
 printf("nEnter the two numbers : ");
 scanf("%d %d", &a, &b);
 //Call Function Sum With Two Parameters
 res = sum(a, b);
 printf("nAddition of two number is : ");
 return (0);
 } 
int sum(int a, int b) 
{
 int c;
 c = a + b;
 return (c);
}

Output :
Enter the two numbers : 23 32
Addition of two number is : 55