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
write a c program to do the following: a) To find the area of a triangle. b) To convert the temperature from Fahrenheit to Celsius. c) To convert the time in hours : minutes : seconds to seconds.
What are c header files?
Explain what is dynamic data structure?
Difference between exit() and _exit() function?
Why is structure padding done in c?
Can you please explain the difference between strcpy() and memcpy() function?
What are near, far and huge pointers?
What are the types of arrays in c?
What is an lvalue in c?
Are comments included during the compilation stage and placed in the EXE file as well?
How is actual parameter different from the formal parameter?
main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }
What does a derived class inherit from a base class a) Only the Public members of the base class b) Only the Protected members of the base class c) Both the Public and the Protected members of the base class d) .c file
What does *p++ do?
What is the difference between procedural and declarative language?