program in c to print 1 to 100 without using loop
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
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 |
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 |
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 |
Why doesn't the code "a[i] = i++;" work?
what are bps & baud rates? differentiate these two?
write a programme to convert temperature from farenheit to celcius?
Write a program to print factorial of given number without using recursion?
a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list
There are 8 billiard balls, and one of them is slightly heavier, but the only way to tell was by putting it on a weighing scale against another. What's the fewest number of times you'd have to use the scale to find the heavier ball?
write a c program to find the probability of random numbers between 1-1000
if a person is buying coconuts of Rs10,and then sell that coconuts of Rs9,with the loss of one rupee.After that the person became a millaniore.how?
What is volatile
How to find the digits truncation when assigning the interger variable to the character variables. like int i=500; char x = i : here we have truncation. how to find this. another ex: i =100; char x=i. here we do not have truncation.
a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler
how to find the binary of a number?