Sunday, March 26, 2017

Function in c with return example

/// write a program that will take two
///integers and find out their summation
///in add() function and also the subtraction in sub() function

#include<stdio.h>

int add(int a, int b )
{
    return a + b  ;

}

int sub(int a,int b)
{
    return a-b;

}


void main()
{
   scanf("%d%d",&a,&b);
   printf("Summation = %d \n",add(a,b));
   printf("subtraction = %d \n",sub(a,b));

}






No comments:

Post a Comment