Welcome Guest | Sign in | Register
Loops - Discussion Page For Q.10429 | C Programming Questions and Answers | C Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > Loops > Questions and Answers

Q: The statement which produces the following output is, (hint: use two nested for loops)
 1
22
333
4444
55555
A. Statement 1
for(a = 1; a <= 5; a = a + 1) {
for( b = 1; b <= 5; b = b + 1)
printf("%d", b);
printf("\n");
}
B. Statement 2
for( a = 1; a <= 5; a = a + 1) {
for( b = 1; b <= a; b = b + 1)
printf("%d", a);
printf("\n");
}
C. Statement 3
for( a = 1; a <= 5; a = a + 1) {
for( b = a; b <= 5; b = b + 1)
printf("%d", b);
printf("\n");
}
D. Statement 4
for( a = 1; a <= 5; a = a + 1) {
for( b = 1; b < a; b = b + a)
printf("%d", b);
printf("\n");
}

Answer and Explanation

Answer:Statement 2
for( a = 1; a <= 5; a = a + 1) {
for( b = 1; b <= a; b = b + 1)
printf("%d", a);
printf("\n");
}

Explanation:
There is no explanation...

Comment on this Question

Name:

Loading...




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.