Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Name: William Horowitz
- Course: CSCI 1110-03
- Subject: Assignment 1
- Instructor: Dr. Reza Sadeghi
- Date: 02/23/2021
- */
- #include <stdio.h>
- #include <math.h>
- int main (void) {
- puts("\n\n\t************************\n\tWelcome to Billy's Calculator\n\t************************");
- double x,y;
- char Operator;
- printf("Please enter the operation you want to perform +,-,*,/,s,e :");
- scanf("%c",&Operator);
- printf("Please enter the first number :");
- scanf("%lf",&x);
- printf("Please enter the second number :");
- scanf("&lf",&y);
- if (Operator == "+")
- {
- puts("ADDITION");
- printf("%.2f added to %.2f is %.2f\n",x,y,x+y);
- }
- else if (Operator == "-") {
- printf("%.2f minus %.2f is %.2f\n",x,y,x-y);
- }
- else if (Operator == "*") {
- printf("%.2f multiplied by %.2f is %.2f\n",x,y,x*y);
- }
- else if (Operator == "/") {
- printf("%.2f divided by %.2f is %.2f\n",x,y,x/y);
- }
- else if (Operator == "e") {
- printf("%.2f to the power of 2 is %.2f and %.2f to the power of 2 is %.2f\n",x,x*x,y,y*y);
- }
- return 0;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement