top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

What is the equivalent code of the following statement in WHILE LOOP format?

+2 votes
for (a=1; a<=100; a++)

printf ("%d\n", a * a);
posted Dec 2, 2014 by Vinitha

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote

while (a<=100) {

printf ("%d\n", a * a);


answer Dec 2, 2014 by Shivaranjini
For Linux,
You can not put semicolon inside the bracket of while();
Hi all ,I am not getting that how this program is executing .. can you run it on after removing all errors with comments? it isn't supporting gcc so on which compiler you ran this code?
did you run it on turboc++?
0 votes

For Linux,,,

It will show syntax error..
you can not write like that..

Correct Syntax is;

for(initialization ; condition checking ; action)

answer Dec 10, 2014 by Chirag Gangdev
Similar Questions
–1 vote
  printf("%d,\n", i);

Loop does not run for 10 iterations, what is the error?

+3 votes

While(0) means dont enter into it, but why you want to have while(0) in c code. Any suggestion.

Asked in the interview today.

Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.