Write a C program to print 1 2 3 ... 100 without using
loops?
Answers were Sorted based on User's Feedback
Answer / vikash kumar dixit
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n;
A:
printf("%d",i);
i++;
switch(n)
{
case 100:
break();
default:goto A;
}
getch();
}
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / olga
void printer(int num)
{
if(n==0)
return;
printer(--n);
printf("%d ",n);
}
| Is This Answer Correct ? | 11 Yes | 14 No |
Answer / mwolo fabrice
#include<stdio.h>
#include<conio.h>
void main()
{
int n=100,i;
scanf("%d",&i);
if(i<n)
{
printf("\n %d\n",i);
}
getch();
}
| Is This Answer Correct ? | 0 Yes | 3 No |
Answer / professor uday kumar bhupathi
void main(int n)
{
if(n==0)
return;
main(--n);
printf("%d ",n);
getch();
}
| Is This Answer Correct ? | 12 Yes | 16 No |
Answer / vijaya raghavan
#include<stdio.h>
int i=100;
main()
{
if (i==0) return 0;
printf("%d\t",i);
i--;
main();
}
| Is This Answer Correct ? | 4 Yes | 11 No |
How to write in a function declaration and in function call in which the function has 'n' number of varible or arguments?
What is a newline escape sequence?
What are two dimensional arrays alternatively called as?
given post order,in order construct the corresponding binary tree
What does int main () mean?
Why we use int main and void main?
how is the examination pattern?
Convert a distance from miles to kilometers .there are 5280 feets per mile,12 inches per foot .2.54 centimeters per inch and 100000centimeters per kilometer
a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none
typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?
What are the __date__ and __time__ preprocessor commands?
How are 16- and 32-bit numbers stored?