How many times does the word Hello print in the following pi


How many times does the word \"Hello\'\' print in the following piece of code. for a = 1 to 10 for b = 8 to 11 print \"Hello\" end for end for

Solution

In the above code \"Hello\" word will print 40 times.

Here i check with C programming Lamguage. In any programmig Language logic will work same so output will be same as 40.

#include <stdio.h>
#include <stdlib.h>

int main()
{
/*Declare a as Variable*/
int a;
/*Declare b as Variable*/
int b;
int count=0;
/*outer for loop*/
for(a=1; a<=10; a++){
/*inner for loop*/
for(b=8;b<=11;b++){
printf(\"%d:Hello\ \",++count);
}/*End of inner for loop*/
}/*End of outer for loop*/
return 0;
}

--------------------------------

output sample:-

1:Hello
2:Hello
3:Hello
4:Hello
5:Hello
6:Hello
7:Hello
8:Hello
9:Hello
10:Hello
11:Hello
12:Hello
13:Hello
14:Hello
15:Hello
16:Hello
17:Hello
18:Hello
19:Hello
20:Hello
21:Hello
22:Hello
23:Hello
24:Hello
25:Hello
26:Hello
27:Hello
28:Hello
29:Hello
30:Hello
31:Hello
32:Hello
33:Hello
34:Hello
35:Hello
36:Hello
37:Hello
38:Hello
39:Hello
40:Hello

---------------------------------------------------------------------------------------------

If you have any query, please feel free to ask

Thanks a lot

 How many times does the word \
 How many times does the word \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site