Sunday, March 26, 2017

Add sub and multiplication in c with function 2

#include<stdio.h>
int a,b;
void add()
{
    //int a=6,b=3; // local var
//    a=6;
//    b=1;
    printf("Enter two values for addition \n");
    scanf("%d%d",&a,&b);
    printf("summation=%d \n",a+b);

}

void sub()
{
    printf("Enter two values for subtraction \n");
    scanf("%d%d",&a,&b);
    printf("subtraction=%d \n",a-b);

}

void multi()
{
    printf("Enter two values for multiplication \n");
    scanf("%d%d",&a,&b);

    printf("multiplication=%d \n",a*b);

}

main()
{


    printf("We R in main function \n");
    add();
    sub();
    multi();





}

No comments:

Post a Comment