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 progarm to find the length of string using switch case?
how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?
What is the difference between functions getch() and getche()?
What is the Purpose of 'extern' keyword in a function declaration?
What are the salient features of c languages?
Explain a pre-processor and its advantages.
What are the types of pointers?
Why is python slower than c?
Is there any data type in c with variable size?
Why do we write return 0 in c?
What is time complexity c?
What is volatile variable in c with example?
how can I convert a string to a number?
What is the purpose of realloc()?
In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)