Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(){
- printf("HERE IS A CALCULATOR.PRESS 1 FOR SUM, 2 FOR SUBTRACT, 3 FOR MULTIPLATION, 4 FOR DIVISION\n");
- float x;
- scanf("%f", &x);
- if(x==1){
- printf("Give me 2 numbers to get its sum.\n");
- float a,b;
- scanf("%f",&a);
- scanf("%f",&b);
- printf("Sum is %f.\n", a+b);
- }
- else if(x==2){
- printf("Give me 2 numbers to get its variance.\n");
- float c,d;
- scanf("%f",&c);
- scanf("%f",&d);
- printf("The variance is %f.\n", c-d);
- }
- else if(x==3){
- printf("Give me 2 numbers to get its product.\n");
- float e,f;
- scanf("%f",&e);
- scanf("%f",&f);
- printf("Sum is %f.\n", e*f);
- }
- else if(x==4){
- printf("Give me 2 numbers to get its .\n");
- float g,h;
- scanf("%f",&g);
- scanf("%f",&h);
- printf("The quotient is %f.\n", g/h);
- }
- else{
- printf("Press 1 or 2 or 3 or 4!\n"); }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement