5. How many the number of errors in the following sub_ program? #include void main( ) { intnum, sum = 1; for (int i = 1, i<= 10, i ++ ) { cout<<“enter your number: “; cin>>num; if ( num> 0 ) sum = sum + num; cout<<“the sum is: << sum; } a) 7 b) 4 c) 5 d) 3 e) None of the mentioned 6. The advantage of a SWITCH over an ELSE-IF statement is: a) A default condition can be used in switch b) The switch is easier to understand c) Several different condition can cause one set of statements to be executed in a switch d) Several different statements can be executed in a switch e) All of the mentioned

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter6: Arrays
Section: Chapter Questions
Problem 10PE
icon
Related questions
Question
5. How many the number of errors in the following sub_ program?
#include<iostream.h>
void main( )
{
intnum, sum = 1;
for (int i= 1, i<= 10, i ++ )
{
cout<<“enter your number: “;
cin>>num;
if ( num> 0 )
sum = sum+ num;
cout<<“the sum is: << sum; }
a) 7
b) 4
c) 5
d) 3
e) None of the mentioned
6. The advantage of a SWITCH over an ELSE-IF statement is:
a) A default condition can be used in switch
b) The switch is easier to understand
c) Several different condition can cause one set of statements to be
executed in a switch
d) Several different statements can be executed in a switch
e) All of the mentioned
Transcribed Image Text:5. How many the number of errors in the following sub_ program? #include<iostream.h> void main( ) { intnum, sum = 1; for (int i= 1, i<= 10, i ++ ) { cout<<“enter your number: “; cin>>num; if ( num> 0 ) sum = sum+ num; cout<<“the sum is: << sum; } a) 7 b) 4 c) 5 d) 3 e) None of the mentioned 6. The advantage of a SWITCH over an ELSE-IF statement is: a) A default condition can be used in switch b) The switch is easier to understand c) Several different condition can cause one set of statements to be executed in a switch d) Several different statements can be executed in a switch e) All of the mentioned
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Mathematical functions
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning