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 |
Write a program to swap two numbers without using the third variable?
Program to find the sum of digits of a given number until the sum becomes a single digit
what are the advantages & disadvantages of unions?
how to find greatet of 10 numbers without using array?
Why should I prototype a function?
write a program to find the frequency of a number
What is the 'named constructor idiom'?
Write a program that receives as input a number omaadel-n-print, four digits.
Write code for atoi(x) where x is hexadecimal string.
Why clrscr is used after variable declaration?
write a own function for strstr
how to find out the inorder successor of a node in a tree??