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 / govind

#include<conio.h>
#include<stdio.h>
void main()
{
int i;
clrscr();
printf("\n the value of the 100 to 0 \n");
for(i=100;i>0;i--)
{
if(i==0)
{
goto start;
}
printf(" %d\t",i);
}

printf("\nthe value of the 0 to 100 \n ");
start:
if(i==100)
{
goto end;
}
printf("%d\t",i);
i++;
goto start;
end :
printf("End of the program");
getch();
}

Is This Answer Correct ?    6 Yes 67 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none

720


What is a void * in c?

602


What is a keyword?

753


List out few of the applications that make use of Multilinked Structures?

1312


What are the parts of c program?

642






What’s a signal? Explain what do I use signals for?

614


When should I declare a function?

629


Explain what are its uses in c programming?

600


Explain what is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?

646


What type is sizeof?

591


What are dangling pointers in c?

650


Why c is faster than c++?

637


Explain what is wrong with this statement? Myname = ?robin?;

1043


How can I read a binary data file properly?

637


How can I prevent another program from modifying part of a file that I am modifying?

618