Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //by Nicholas Tony Gomes
- #include <stdio.h>
- int main()
- {
- double a,b;
- char chr;
- int counter;
- printf("Enter two numbers\n");
- scanf("%lf%lf",&a,&b);
- printf("Enter if you want to add subtract or multiply or divide\n");
- scanf(" %c",&chr);
- if(chr=='a'||chr=='A')
- {
- printf("%.2lf",a+b);
- }
- else if(chr=='s'||chr=='S')
- {
- printf("%.2lf",a-b);
- }
- else if(chr=='m'||chr=='M')
- {
- printf("%.2lf",a*b);
- }
- else if(chr=='d'||chr=='D')
- {
- printf("%.2lf",a/b);
- }
- else
- {
- printf("invalid input");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement