Write a C++ program without using any loop (if, for, while
etc) to print numbers from 1 to 100 and 100 to 1;

Answer Posted / jihad mzahim

int main()
{
int i=100;
start:
if(i==0)
{
printf("\t\t************************************************\n\n");
goto start1;

}

printf("%d\t",i);
i--;
goto start;

start1:
if(i==101)
goto end;
printf("%d\t",i);
i++;
goto start1;

end:
printf("\n end of the program");

return 0;

}

Is This Answer Correct ?    3 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell

1654


the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters

1786


Why clrscr is used after variable declaration?

1026


What is the scope of static variables in c language?

618


What is a dynamic array in c?

579






why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above

598


What is structure of c program?

589


What's a good way to check for "close enough" floating-point equality?

613


Is c procedural or functional?

574


What are the rules for identifiers in c?

573


Write a function that will take in a phone number and output all possible alphabetical combinations

587


What are the difference between a free-standing and a hosted environment?

726


What is the best way to store flag values in a program?

568


Why is c known as a mother language?

730


Define and explain about ! Operator?

604