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
What is difference between scanf and gets?
Was 2000 a leap year?
What are valid operations on pointers?
int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;
Is c dynamically typed?
What is null in c?
How many levels of pointers have?
What is hash table in c?
How to Throw some light on the splay trees?
Explain what are bus errors, memory faults, and core dumps?
Do you know what are bitwise shift operators in c programming?
What are header files in c programming?
What are structures and unions? State differencves between them.
Can you please explain the difference between exit() and _exit() function?
What is a ternary operator in c?