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

Can we change the value of static variable in c?

560


Which driver is a pure java driver

990


How can I write functions that take a variable number of arguments?

625


What is an lvalue in c?

694


Hello. How to write a C program to check and display president party like if i type in the console "biden" and hit enter the output shoud be : "biden is democrat" and if i type "trump" and hit enter the output shoud be: "trump is republican"

1582






what value is returned to operating system after program execution?

1602


What is structure of c program?

601


Why does the call char scanf work?

618


If jack lies on Mon, Tue Wed and jill lies on Thursday, Friday and Saturday. If both together tell they lied yesterday. So c the given options and then c cos in the given dates one will be saying the truth and one will be lying. I got Thursday as option because jack is saying the truth he lied yest but jill is lying again as he lies on that day.

1789


Write a program to print “hello world” without using semicolon?

672


What language is lisp written in?

617


When should structures be passed by values or by references?

582


How do you convert strings to numbers in C?

707


Why do we use main function?

633


What is hashing in c?

641