Walk Lightly on this PLANET and yet leave such a FOOTPRINT that cannot be erased for thousands of Years..!!!
Visit Codstech for Cyber Security related Posts !

Visitors

Friday, May 20, 2011

C31 : Addition of two numbers using pass by value method

Back to Home   &  C


//Program to find addition of two numbers using pass by value method

#include<stdio.h>
#include<conio.h>
int add(int,int);
void main()
{
clrscr();
int a,b,c;
printf("Enter two numbers\n");
scanf("%d%d",&a,&b);
c=add(a,b);
printf("addition=%d",c);
getch();
}
int add(int n,int m)
{
int s;
s=n+m;
return(s);
}

---------------------------------------------------------------
Output :
Enter two numbers
3
5
addition=8
=========================================================================
Back to Home   &  C

2 comments:

Radzbull said...

why in the above program u did not define the variable name in first add function statement.

TD said...

Defining variable names during function prototyping is not necessary. We can do it during the function definition.