Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Write a C++ program without using any loop (if, for, while
etc) to print numbers from 1 to 100 and 100 to 1;

Answers were Sorted based on User's Feedback



Write a C++ program without using any loop (if, for, while etc) to print numbers from 1 to 100 and..

Answer / harpreet kaur

we can create our own header file having a function to
print nos with loop and then use that header file in new
prog with the functoin defined in it.

Is This Answer Correct ?    30 Yes 37 No

Write a C++ program without using any loop (if, for, while etc) to print numbers from 1 to 100 and..

Answer / ravi sagar

#include<stdio.h>
#include<conio.h>

void main()
{
clrscr();
int i;
int j=100;
int c=0;
printf("1 to 100 then 99 to 1");
for(i=1;i<=100;i++;)
{ if (c==0)
{
printf("%d",i);
if(i==100)
{
c=1;
}
}
if(c==1)
{
j--;
printf("%d",j);
if(j==0)
{
break;
}
}
}

Is This Answer Correct ?    4 Yes 11 No

Write a C++ program without using any loop (if, for, while etc) to print numbers from 1 to 100 and..

Answer / bitan biswas

We can do that by recursive call.....

void fun(int no ){
int t;
printf("%d ",no);
if( no != 100 ){
t=no+1;
fun(t);
}
printf("%d ",no);
}

int main(){
fun(1);
return 0;
}

Is This Answer Correct ?    17 Yes 27 No

Write a C++ program without using any loop (if, for, while etc) to print numbers from 1 to 100 and..

Answer / solairaja

void main()
{
int i;
V:
printf("%d",i++);
goto V;
}

Is This Answer Correct ?    3 Yes 17 No

Write a C++ program without using any loop (if, for, while etc) to print numbers from 1 to 100 and..

Answer / pur

main()
{
int i =100;

start:
if( i == 0)
goto end;
printf(" %d ",i)
i--;
goto start;

end:
printf(" end of the program");
}

Is This Answer Correct ?    20 Yes 47 No

Write a C++ program without using any loop (if, for, while etc) to print numbers from 1 to 100 and..

Answer / gandhi priyank

goto statment is also right because goto statement is not a
loop
e.g.
void main()
{
j:
printf("type your text here");

goto j;
}

Is This Answer Correct ?    10 Yes 42 No

Write a C++ program without using any loop (if, for, while etc) to print numbers from 1 to 100 and..

Answer / balaji.k

#include<stdio.h>
#include<conio.h>
void main()
{
clescr();
int i,chl,start;
printf("enter the number from 1 to 100\n");
scanf("%d",ch);
else
go to start
start=1 to 100;
else
go end
exit(0);
}

Is This Answer Correct ?    3 Yes 37 No

Write a C++ program without using any loop (if, for, while etc) to print numbers from 1 to 100 and..

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

More C Interview Questions

What is meant by int main ()?

0 Answers  


Write a c program for sum of first n terms of the series S = 1 - (1/3) + (1/5) -(1/7) + (1/9) ......

2 Answers  


how does a general function , that accepts an array as a parameter, "knows" the size of the array ? How should it define it parameters list ?

2 Answers   Patni, TCS,


Explain how do you search data in a data file using random access method?

0 Answers  


How many types of operators are there in c?

0 Answers  


What are the general description for loop statement and available loop types in c?

0 Answers  


What are high level languages like C and FORTRAN also known as?

0 Answers  


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"

0 Answers  


will u please send me the placement papers to my mail???????????????????

0 Answers  


Given an array of numbers, except for one number all the others occur twice. Give an algorithm to find that number which occurs only once in the array.

6 Answers  


How can I get random integers in a certain range?

0 Answers  


Is main is user defined function?

0 Answers  


Categories