InterviewSolution
Saved Bookmarks
| 1. |
How many 'a' will be printed when the following code is executed? #include int main() { int i=0; char c='a'; while(i |
|
Answer» 6Explanation:As i is initialized with 0,with while CONDITION of i<5, followed by incrementation,the i enters the loop for 5 times with values 0,1,2,3,4 resulting 5 'a's to GET printed.And, after the termination of loop, print("a\n") statement prints another a (now the count is 6) and goes to new line; thereby the PROGRAM ends.So, the total NUMBER of 'a's getting printed is 6 in number. |
|