What will be the output and how many times the loop will get executed..
#include iostream.h
void main() {
int num=10,sum=0,i=1;
while(i<=num) {
sum=sum+i;
i++;
}
Answers
Answered by
1
The loop will work 10 times.
value of sum=55.
last value of i=11.
But,.... since there is no System.out.print/println statement,you will get no output.
value of sum=55.
last value of i=11.
But,.... since there is no System.out.print/println statement,you will get no output.
Vintagebroken:
U mean there is no cout<
Answered by
4
The program will be successfully compiled, But it returns no value at runtime. Because you are not printing anything(Cout) (or) return.
Similar questions
CBSE BOARD X,
8 months ago
Computer Science,
8 months ago
India Languages,
8 months ago
Math,
1 year ago
Social Sciences,
1 year ago
Social Sciences,
1 year ago