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 to print 1 2 3 ... 100 without using
loops?

Answers were Sorted based on User's Feedback



Write a C program to print 1 2 3 ... 100 without using loops?..

Answer / sutanu

void main ()
{
static int i;
if (i <= 100)
{
printf ("%d\n", i);
i++;
main ();
}
}

Is This Answer Correct ?    53 Yes 15 No

Write a C program to print 1 2 3 ... 100 without using loops?..

Answer / gunabalan

void main()
{
int i=1;
e:
printf("%d\t",i);
i++;
if(i<=100)
goto e;
}

Is This Answer Correct ?    36 Yes 12 No

Write a C program to print 1 2 3 ... 100 without using loops?..

Answer / lakshmipraba

#include<stdio.h>
int i;
void main()
{
if(i<=100)
{
printf("%d ",i);
i++;
main();
}
if(i>100)
exit(0);
}

Is This Answer Correct ?    14 Yes 3 No

Write a C program to print 1 2 3 ... 100 without using loops?..

Answer / vivek

void main()
{
int i=1;
if(i<=100)
printf("%d",i);
continue;
getch();
}

Is This Answer Correct ?    6 Yes 2 No

Write a C program to print 1 2 3 ... 100 without using loops?..

Answer / neha

int i;
void main(void)
{
if(i<=100)
printf("%d\n", i);
i++;
main();
getch();
}

Is This Answer Correct ?    29 Yes 26 No

Write a C program to print 1 2 3 ... 100 without using loops?..

Answer / uma maheswari

#include<stdio.h>
#include<conio.h>
int i=1;
void main()
{
i<=100 ? printf("%d\n",i) : getch(); //conditional operator
i++;
main(); //recursive calling of main() function
}

Is This Answer Correct ?    10 Yes 7 No

Write a C program to print 1 2 3 ... 100 without using loops?..

Answer / sagar

we can also create such a program without using loops and if
statement too ...

void main()
{
int i,n;
clrscr();
A:
printf("%d",i);
n=i++;
switch(n)
{
case 100: break;
default : goto A;
}
getch();
}

Is This Answer Correct ?    9 Yes 7 No

Write a C program to print 1 2 3 ... 100 without using loops?..

Answer / harsha

#include<stdio.h>

int i=0;

void main()
{
if(i==0)
clrscr();
if(i<100) {
printf("%d \t",++i);
main(); }
else {
getch();
exit(0); }
}

Is This Answer Correct ?    2 Yes 1 No

Write a C program to print 1 2 3 ... 100 without using loops?..

Answer / maxerp

In general, by using recursion, since it is the only
alternative to looping constructs

Is This Answer Correct ?    11 Yes 12 No

Write a C program to print 1 2 3 ... 100 without using loops?..

Answer / vivek

#include<stdio>
void main()
{
int i=1;
if(i<=100)
printf("%d",i);
i++;
continue;
getch;
}

Is This Answer Correct ?    2 Yes 3 No

Post New Answer

More C Interview Questions

Why is conio.h not required when we save a file as .c and use clrscr() or getch() ?

2 Answers  


Is struct oop?

0 Answers  


What is floating point exception error? And what are different types of errors occur during compile time and run time? why they occur?

1 Answers  


simple c program for 12345 convert 54321 with out using string

7 Answers   TCS,


What is difference between array and structure in c?

0 Answers  


Write a program to print fibonacci series using recursion?

0 Answers  


If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?

0 Answers  


How to draw the flowchart for structure programs?

0 Answers  


Can 'this' pointer by used in the constructor?

0 Answers  


How #define works?

0 Answers  


Why c is called a mid level programming language?

0 Answers  


What are the preprocessors?

9 Answers   HP,


Categories