Sunday, May 5, 2013

Adding C program using functions


/* An to the Functions*/
#include<stdio.h>
int add(int,int);
main()
{
    int a, b, c;
    clrscr();
    printf("Enter A and B values:");
    scanf("%d %d",&a,&b);
    c=add(a,b);
    /*Jump to the function name which has add()*/
    printf("The additon is: %d",c);
    getch();
}
int add(x,y)
/*x, y values means given a,b values copy to the x,y like x=a(value which is given)*/
{
    int z;
    /*Add procedure function*/
    z=x+y;
    return(z);     /*read the z value,send to the main where it was faced*/
}


output:

Enter A and B values:
2
5
The additon is: 7


0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More