The Sum and The Difference Code C Language
The Sum and The Difference Code C Language
#include <stdio.h>
int d;
float j,u,w,a,b,c,e,f,g,h,s,k,l;
int main()
{
// Write C code here
printf("The enter number 8 for addion and 7 for subtraction and 9 for multiplication and 11
for division");
printf("\nenter the number = ");
scanf("%d",&d);
if(d==8)
{
goto mm;
}
if(d==7)
{
goto nn;
}
if(d==9)
{
goto rr;
}
if(d==11)
{
goto ee;
}
mm:
printf("the sum of two number");
printf("\nenter the first number = ");
scanf("%f",&a);
printf("\n\nenter the second number=");
scanf("%f",&b);
c=a+b;
printf("\n\nthe sum is =%f",c);
return 0;
nn:
printf("the difference between the two number" );
printf("\nenter the first number = ");
scanf("%f",&h);
printf("\n\nenter the second number=");
scanf("%f",&g);
f=h-g;
printf("\n\nthe difference is = %f",f);
return 0;
rr:
printf("the product of two number");
printf("\nenter the first number = ");
scanf("%f",&s);
printf("\n\nenter the second number=");
scanf("%f",&l);
k=s*l;
printf("\n\nthe product is = %f",k);
return 0;
ee:
printf("the quotient of two number");
printf("\nenter the first number = ");
scanf("%f",&u);
printf("\n\nenter the second number=");
scanf("%f",&w);
j=u/w;
printf("\n\nthe product is = %f",j);
return 0;
}
https://www.programiz.com/online-compiler/2Hdn4fhFEL3s4
https://www.programiz.com/online-compiler/5oVfRXqhqE7MO
https://www.programiz.com/online-compiler/5YuDvTWQJtXF9
https://www.programiz.com/online-compiler/4eYOWvRDE8G1w