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

Write a progarm to find the length of string using switch case?

1828


how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?

1679


What is the difference between functions getch() and getche()?

823


What is the Purpose of 'extern' keyword in a function declaration?

846


What are the salient features of c languages?

846


Explain a pre-processor and its advantages.

838


What are the types of pointers?

777


Why is python slower than c?

806


Is there any data type in c with variable size?

847


Why do we write return 0 in c?

774


What is time complexity c?

744


What is volatile variable in c with example?

776


how can I convert a string to a number?

787


What is the purpose of realloc()?

873


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)

1864