program in c to print 1 to 100 without using loop

Answers were Sorted based on User's Feedback



program in c to print 1 to 100 without using loop..

Answer / gadigebhasker

void otoh(int,int);
void main()
{
int x,y;
printf("enter initial value x & y final value\n");
scanf("%d%d",&x,&y);
printf("0 to 100 number\n");
otoh(x,y);
getch();
}
void otoh(int a,int i)
{
if(a<=i)
{
printf("%d\t",a++);
otoh(a,i);
}
else
printf("END");
}

Is This Answer Correct ?    27 Yes 4 No

program in c to print 1 to 100 without using loop..

Answer / madhavi

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

Is This Answer Correct ?    6 Yes 0 No

program in c to print 1 to 100 without using loop..

Answer / rajasekhar

excellent thiking

Is This Answer Correct ?    5 Yes 1 No

program in c to print 1 to 100 without using loop..

Answer / nishikant kamble

#include<stdio.h>
int main()
{
int i=1;
suhas:
printf("%d\t",i);
i++;
if(i==101)
{
exit(1);
}
goto suhas;
}

Is This Answer Correct ?    2 Yes 0 No

program in c to print 1 to 100 without using loop..

Answer / darshana

Sub Main()
Dim i, j As Integer
Console.WriteLine("enter i numbers")
i = Console.ReadLine()

Console.WriteLine("enter j numbers")
j = Console.ReadLine()
Console.WriteLine()
new1(i, j)

End Sub

Sub new1(ByVal i As Integer, ByVal j As Integer)

Dim num As Integer = i

If num > j Then
Console.WriteLine("end")
Else


Console.WriteLine(num)
num = num + 1
new1(num, j)
End If



End Sub

Is This Answer Correct ?    0 Yes 0 No

program in c to print 1 to 100 without using loop..

Answer / praveen

#include<stdio.h>
#include<stdlib.h>
void prav(int);
main()
{
int i=1;
prav(i);
}

void prav(int j)
{
if(j<101)
{printf("%d\n",j);
j++;
prav(j);}

else
exit(0);


}

Is This Answer Correct ?    0 Yes 0 No

program in c to print 1 to 100 without using loop..

Answer / guest

using recursion

Is This Answer Correct ?    0 Yes 2 No

program in c to print 1 to 100 without using loop..

Answer / gadigebhasker

There are some corrections in the above program keep start label above first if statement and add goto start after the printf statement

Is This Answer Correct ?    0 Yes 4 No

program in c to print 1 to 100 without using loop..

Answer / ashu

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int a;
clrscr();
printf("there are 1 to 100");
a=0;
if(a<100)
{
a++;
printf("%d\n",a);
}
else if(a>100)
{
goto end;
}
end: getch();
}

Is This Answer Correct ?    5 Yes 13 No

Post New Answer

More C Interview Questions

two variables are added answer is stored on not for third variable how it is possible?

3 Answers  


consider the following structure: struct num nam{ int no; char name[25]; }; struct num nam n1[]={{12,"Fred"},{15,"Martin"},{8,"Peter"},{11,Nicholas"}}; ..... ..... printf("%d%d",n1[2],no,(*(n1 + 2),no) + 1); What does the above statement print? a.8,9 b.9,9 c.8,8 d.8,unpredictable value

4 Answers   TCS,


every function has return the value?

1 Answers  


What is nested structure in c?

0 Answers  


write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.

0 Answers  






What are the types of assignment statements?

0 Answers  


What is a floating point in c?

0 Answers  


How old is c programming language?

0 Answers  


What is the role of this pointer?

0 Answers  


in one file global variable int i; is declared as static. In another file it is extern int i=100; Is this valid ?

2 Answers   NetApp,


Write a program to add a given duration with time(24hrs format)

1 Answers   Protech,


Write a C/C++ program that connects to a MySQL server and checks intrusion attempts every 5 minutes. If an intrusion attempt is detected beep the internal speaker to alert the administrator. A high number of aborted connects to MySQL at a point in time may be used as a basis of an intrusion.

1 Answers  


Categories