Determine the output of the given program below if the inputted data are 1 and 3. #include #include #define p printf #define s scanf void main() { int num1,num2; p(“Input 1st number: ”); s(“%d”,&num1); p(“\nInput 2nd number: ”); s(“%d”,&num2); sum=num1+num2; p(“\nThe sum is %d”,sum); getch(); } Select one: a. The sum is 4 b. program error c. sum d. 4 What part of the program has a BUG? #include #include main() { char name[30]; (1) clrsr(); (2) printf(“Name: ”); scanf(“%s”,&name); printf”Hello %s”, name); (3) getch(); return 0; } Select one: a. no error b. line2 c. line 1 d. line 3
Determine the output of the given program below if the inputted data are 1 and 3. #include #include #define p printf #define s scanf void main() { int num1,num2; p(“Input 1st number: ”); s(“%d”,&num1); p(“\nInput 2nd number: ”); s(“%d”,&num2); sum=num1+num2; p(“\nThe sum is %d”,sum); getch(); } Select one: a. The sum is 4 b. program error c. sum d. 4 What part of the program has a BUG? #include #include main() { char name[30]; (1) clrsr(); (2) printf(“Name: ”); scanf(“%s”,&name); printf”Hello %s”, name); (3) getch(); return 0; } Select one: a. no error b. line2 c. line 1 d. line 3
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 10PE
Related questions
Question
Determine the output of the given
#include<conio.h>
#include<stdio.h>
#define p printf
#define s scanf
void main()
{
int num1,num2;
p(“Input 1st number: ”);
s(“%d”,&num1);
p(“\nInput 2nd number: ”);
s(“%d”,&num2);
sum=num1+num2;
p(“\nThe sum is %d”,sum);
getch();
}
Select one:
a. The sum is 4
b. program error
c. sum
d. 4
What part of the program has a BUG?
#include<conio.h>
#include<stdio.h>
main()
{
char name[30]; (1)
clrsr(); (2)
printf(“Name: ”);
scanf(“%s”,&name);
printf”Hello %s”, name); (3)
getch();
return 0;
}
Select one:
a. no error
b. line2
c. line 1
d. line 3
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr