finclude 2 PROGRAM 24 3 int main() 25 case 2: 4 printf("\n2. SUBTRACTION\n"); printf(" printf(" ANs = +d - +d\n", B, A); int A = 10; int B = 15; int ANS = 0; int choice; printf("Basic Calculation\nGivens: "); printf("A = 10 || B = 15\n\n"); printf("Choices:\n"); printf("1. Addition: add A and B\n"); printf("2. Subtraction: subtract A from B\n"); printf("3. Addition and Subtraction\n\n"); printf("Enter choice: "); scanf ("d", &choice); 26 5 27 ANS = B - A\n"); 6 28 29 ANS = B-A; 8. printf(" ANS = $d\n", ANS); break; 30 31 10 32 11 33 case 3: 12 printf("\n3. ADDITION printf(" printf(" printf(" int ANS1 = A+B; 34 SUBTRACTION\n"); 13 35 ANS = A + B ANS = B - A\n"); 14 ANS = id + $d ||", A, B); ANS = d - $d\n", B, A); 36 15 switch (choice) 37 16 38 17 case 1: 39 printf("\nl. ADDITION\n"); printf(" printf(" int ANS2 = B-A; printf(" printf(" ANS = sd\n", ANS2); 18 II", ANS1); 40 ANS = td 19 ANS = A + B\n"); 41 20 ANS = sd + $d\n", A, B); break; 42 21 int ANS = A+B; 43 22 printf(" ANS = sd\n", ANS); 44 return 0; 23 break; 45 Basic Calculation Givens: A - 10 || B - 15 Basic Calculation Givens: A - 10 || B - 15 Choices: 1. Addition: add A and B 2. Subtraction: subtract A from B 3. Addition and Subtraction CASE 1 CASE 3 OUTPUT/s Choices: 1. Addition: add A and B 2. Subtraction: subtract A from B 3. Addition and Subtraction Enter choice: 1 Basic Calculation Givens: A - 10 || B - 15 1. ADDITION Enter choice: 3 ANS - A + B CASE 2 ANS - 10 + 15 Choices: 1. Addition: add A and B 2. Subtraction: subtract A from B execu 3. Addition and Subtraction 3. ADDITION || ii ANS - B - A SUBTRACTION ANS - 25 ANS - A + B ANS = 10 + 15 || ANS = 15 - 10 Process returned e (®x®) Press any key to continue. ANS = 25 ii ANS - 5 Process returned e (8x8) Press any key to continue. Enter choice: 2 execution time : 0.524 s 2. SUBTRACTION ANS - B - A ANS - 15 - 10 ANS = 5 Process returned e (8x®) execution time : 0.685 s Press any key to continue. --- -

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

C program to c++

#include <stdio.h>
2
PROGRAM
24
3
int main ()
25
case 2:
4
printf("\n2. SUBTRACTION\n");
printf ("
printf(" ANS = +d - td\n", B, A);
ANS = B-A:
printf(" ANS = sd\n", ANS);
26
int A = 10; int B = 15; int ANS = 0; int choice;
printf("Basic Calculation\nGivens: ");
printf("A = 10 || B = 15\n\n");
printf("Choices:\n");
printf ("1. Addition: add A and B\n");
printf ("2. Subtraction: subtract A from B\n");
printf("3. Addition and Subtraction\n\n");
printf("Enter choice: ");
scanf ("$d", &choice);
5
27
ANS = B - A\n");
28
7
29
8.
30
31
break;
10
32
11
33
case 3:
12
printf("\n3. ADDITION
printf ("
printf("
printf("
int ANS1 = A+B;
int ANS2 = B-A;
34
SUBTRACTION\n");
13
35
ANS = A + B||
ANS = B - A\n");
14
36
ANS = id + d ||", A, B);
15
switch (choice)
ANS = id - sd\n", B, A);
37
ANS = sd-
16
38
17
case 1:
39
printf("\nl. ADDITION\n");
printf("
printf ("
18
printf("
printf("
40
ANS = td
|I", ANS1);
19
ANS = A + B\n");
41
ANS = $d\n", ANS2);
20
ANS = d + d\n", A, B);
42
break;
21
int ANS = A+B;
43
22
printf ("
ANS = d\n", ANS);
44
return 0;
23
break;
45
Basic Calculation
Givens: A = 10 || B = 15
Basic Calculation
Givens: A - 10 || B - 15
Choices:
1. Addition: add A and B
2. Subtraction: subtract A from B
3. Addition and Subtraction
CASE 1
CASE 3
OUTPUT/s
Choices:
1. Addition: add A and B
2. Subtraction: subtract A from B
3. Addition and Subtraction
Enter choice: 1
Basic Calculation
Givens: A = 10 || B = 15
1. ADDITION
ANS - A + B
Enter choice: 3
CASE 2
Choices:
1. Addition: add A and B
2. Subtraction: subtract A from B
execu 3. Addition and Subtraction
ANS - 10 + 15
!!
ANS = A + B
ANS - 10 + 15 ||
||
3. ADDITION
SUBTRACTION
ANS - 25
ANS - B - A
ANS = 15 - 10
Process returned 0 (exe)
Press any key to continue.
ANS - 25
ANS = 5
Process returned e (exe)
Press any key to continue.
Enter choice: 2
execution time : 0.524 s
2. SUBTRACTION
ANS - B - A
ANS - 15 - 10
ANS = 5
Process returned e (exe) execution time : 0.685 s
Press any key to continue.
Transcribed Image Text:#include <stdio.h> 2 PROGRAM 24 3 int main () 25 case 2: 4 printf("\n2. SUBTRACTION\n"); printf (" printf(" ANS = +d - td\n", B, A); ANS = B-A: printf(" ANS = sd\n", ANS); 26 int A = 10; int B = 15; int ANS = 0; int choice; printf("Basic Calculation\nGivens: "); printf("A = 10 || B = 15\n\n"); printf("Choices:\n"); printf ("1. Addition: add A and B\n"); printf ("2. Subtraction: subtract A from B\n"); printf("3. Addition and Subtraction\n\n"); printf("Enter choice: "); scanf ("$d", &choice); 5 27 ANS = B - A\n"); 28 7 29 8. 30 31 break; 10 32 11 33 case 3: 12 printf("\n3. ADDITION printf (" printf(" printf(" int ANS1 = A+B; int ANS2 = B-A; 34 SUBTRACTION\n"); 13 35 ANS = A + B|| ANS = B - A\n"); 14 36 ANS = id + d ||", A, B); 15 switch (choice) ANS = id - sd\n", B, A); 37 ANS = sd- 16 38 17 case 1: 39 printf("\nl. ADDITION\n"); printf(" printf (" 18 printf(" printf(" 40 ANS = td |I", ANS1); 19 ANS = A + B\n"); 41 ANS = $d\n", ANS2); 20 ANS = d + d\n", A, B); 42 break; 21 int ANS = A+B; 43 22 printf (" ANS = d\n", ANS); 44 return 0; 23 break; 45 Basic Calculation Givens: A = 10 || B = 15 Basic Calculation Givens: A - 10 || B - 15 Choices: 1. Addition: add A and B 2. Subtraction: subtract A from B 3. Addition and Subtraction CASE 1 CASE 3 OUTPUT/s Choices: 1. Addition: add A and B 2. Subtraction: subtract A from B 3. Addition and Subtraction Enter choice: 1 Basic Calculation Givens: A = 10 || B = 15 1. ADDITION ANS - A + B Enter choice: 3 CASE 2 Choices: 1. Addition: add A and B 2. Subtraction: subtract A from B execu 3. Addition and Subtraction ANS - 10 + 15 !! ANS = A + B ANS - 10 + 15 || || 3. ADDITION SUBTRACTION ANS - 25 ANS - B - A ANS = 15 - 10 Process returned 0 (exe) Press any key to continue. ANS - 25 ANS = 5 Process returned e (exe) Press any key to continue. Enter choice: 2 execution time : 0.524 s 2. SUBTRACTION ANS - B - A ANS - 15 - 10 ANS = 5 Process returned e (exe) execution time : 0.685 s Press any key to continue.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY