Program for Calculating Arithmetic Operations using Functions.

# include<stdio.h> #include<conio.h> add ( ); int sub ( ); mul ( int x, int y); div(); main( ) { int a, b, d; ...

# include<stdio.h>
#include<conio.h>
add ( );
int sub ( );
mul ( int x, int y);
div();
main( )
{
int a, b, d;
printf (“enter two values”);
scanf(“% d %d”, &a , &b);
add ( );
d=sub();
mul (a, b);
div();
printf (“\n difference is % d”, d) ;
getch();
}

add ( )
{
int x, y, z;
printf (“enter two values”);
scanf ( “ % d % d”, & x,& y);
z = x+y;
printf (“addition value is % d”, z);
}

int sub ( )
{
int x, y, z;
printf ( “enter 2 value”);
scanf (“% d %d”, & x , & y);
z = x–y;
return (z);
}

mul ( int x, int y)
{
int z;
z= x * y;
printf (“\n product is % d”, z);
}

div ( )
{
int x,y,z;
printf (“enter 2 values “) ;
scanf (“%d%d”, & x, & y);
z = x/y;
printf (“\n Result is % d”, z);

}

Related

C Programs 5083080058038491946

Post a Comment

emo-but-icon

item