Tuesday, 29 September 2015

C Program to Subtract two numbers using function at ending of the Program



/*Program to Subtract two numbers using function at ending of the Program*/
#include<stdio.h>
int subtract(int,int);
main()
{
      int num1,num2,ans;
      printf("\n Enter the First Number  ");
      scanf("%d",&num1);
      printf("\n Enter the second Number  ");
      scanf("%d",&num2);
      ans=subtract(num1,num2);
      printf("\n the value of %d - %d is %d ",num1,num2,ans);
}
int subtract(int first, int second)
{
      int result;
      result=first-second;
      return(result);
}

No comments:

Post a Comment