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

What is difference between scanf and gets?

614


Was 2000 a leap year?

632


What are valid operations on pointers?

669


int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;

1128


Is c dynamically typed?

667






What is null in c?

600


How many levels of pointers have?

594


What is hash table in c?

574


How to Throw some light on the splay trees?

621


Explain what are bus errors, memory faults, and core dumps?

792


Do you know what are bitwise shift operators in c programming?

586


What are header files in c programming?

657


What are structures and unions? State differencves between them.

619


Can you please explain the difference between exit() and _exit() function?

594


What is a ternary operator in c?

654