C Program add two given numbers using user defined Function | UDF to add to number in C
#includeint getsum(int a,int b); //declaration of function int main() { int i,j,k; printf("The program to add two numbers.\n"); printf("Enter first number.\n"); scanf("%d",&i); printf("Enter second number.\n"); scanf("%d",&j); k=getsum(i,j); printf("Sum = %d\n",k); } int getsum(int a,int b) //definition of function { int temp; temp=a+b; return temp; }
No comments:
Post a Comment