Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void)
- {
- double num1, num2;
- double product=0;
- double type;
- double xit;
- restart:
- printf("Please Input the first Number\n");
- scanf("%lf", &num1);
- printf("Please Input the Second Number\n");
- scanf("%lf", &num2);
- printf("Please enter\n 1:Addition %.2f + %.2f \n 2:Subtraction %.2f - %.2f \n 3:Multiplication %.2f * %.2f \n 4:Division %.2f / %.2f \n", num1, num2, num1, num2, num1, num2, num1, num2);
- scanf("%lf", &type);
- if (type == 1)
- product = num1 + num2;
- else if (type == 2)
- product = num1 - num2;
- else if (type == 3)
- product = num1 * num2;
- else if (type == 4)
- product = num1 / num2;
- printf("The Solution is %.2f\n", product);
- printf("To Exit press 1 or press 2 to restart\n");
- scanf("%lf", &xit);
- if (xit == 1)
- goto end;
- else if (xit == 2)
- system("cls");
- goto restart;
- end:
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment