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 |
extern static int i func() { i =10; i++; printf("%d \n",i); } main() { i =20; printf("%d \n",i); func(); printf("%d \n",i); }
Explain the red-black trees?
how can make variable not in registers
What is wrong with this program statement?
question-how to run a c programme.
Write a program to reverse a given number in c?
#include<stdio.h> int main(){ int i=10; int *ptr=&i; *ptr=(int *)20; printf("%d",i); return 0; } Output: 20 can anyone explain how came the output is 20
What are the two types of structure?
What is structure and union in c?
How can I implement a delay, or time a users response, with sub-second resolution?
print ur name 20,000 times without using inbuilt library functions like printf,scanf,gets,puts,getchar or putchar
What are conditional operators in C?