print numbers till we want without using loops or condition
statements like specifically(for,do while, while swiches,
if etc)!

Answers were Sorted based on User's Feedback



print numbers till we want without using loops or condition statements like specifically(for,do wh..

Answer / raghuram.a

//Simple.use recursion!
#include<stdio.h>
int f(int i,int n)
{
i<=n&&printf("\t%d",i)&&f(++i,n);
return 1;
}
main()
{
f(1,100);
return 0;
}

Is This Answer Correct ?    13 Yes 6 No

print numbers till we want without using loops or condition statements like specifically(for,do wh..

Answer / anil

//To print 1-50 without using any loops or condition statement
main()
{
static int i;
printf("%d \n",i++);
(i%51)&&main();
}

Is This Answer Correct ?    11 Yes 11 No

print numbers till we want without using loops or condition statements like specifically(for,do wh..

Answer / pree

i wnt to print 1 to 15 without using any loop,conditional
statments ,ternary operators,if conditions
nothing.........is dere any way now to print the numbers????/

Is This Answer Correct ?    2 Yes 2 No

print numbers till we want without using loops or condition statements like specifically(for,do wh..

Answer / uday

Console.WriteLine(
String.Join(
", ",
Array.ConvertAll<int, string>(
Enumerable.Range(1, 100).ToArray(),
j => j.ToString()
)
)
);

Is This Answer Correct ?    0 Yes 0 No

print numbers till we want without using loops or condition statements like specifically(for,do wh..

Answer / grasshopper

simple !
create a loop by main()

.i.e call main(previous_num) from main.

till break char is hit.

Is This Answer Correct ?    9 Yes 10 No

print numbers till we want without using loops or condition statements like specifically(for,do wh..

Answer / prince

main()
{
int n;
printf("enter limit:");
scanf("%i",&n);
print(n);
}

print(int n)
{
n>0?print(n-1):printf("");
printf("\n%d",n);
}

Is This Answer Correct ?    10 Yes 11 No

print numbers till we want without using loops or condition statements like specifically(for,do wh..

Answer / nain

plz explain above answer ......

Is This Answer Correct ?    3 Yes 5 No

print numbers till we want without using loops or condition statements like specifically(for,do wh..

Answer / srujana

#include<stdio.h>
void main()
{
int i=0;
printf("value of i",(i>=100)?exit(0):i);
i++;
continue;
}
OR
by using recursion
#include<stdo.h>
int rec(int i)
{
if(i>=100)
return;
else
i++;
return i;
}
void main()
{
rec(1);
}

Is This Answer Correct ?    0 Yes 4 No

print numbers till we want without using loops or condition statements like specifically(for,do wh..

Answer / srividhya

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
int i=0,n,x;
scanf("%d",&n);
label1:
{
printf("%d",i);
i++;
x=i<n?i:0;
exit(x);
continue;
}
getch();
}

Is This Answer Correct ?    8 Yes 15 No

print numbers till we want without using loops or condition statements like specifically(for,do wh..

Answer / akshay babar

#include<stdio.h>
int print(int i)
{
if(i>0)
return print(printf("%d", i--));
else
return 1;
}
main()
{
print(100);
return 0;
}

Is This Answer Correct ?    2 Yes 11 No

Post New Answer

More C Code Interview Questions

Write a program to print a square of size 5 by using the character S.

6 Answers   Microsoft,


Is the following code legal? typedef struct a { int x; aType *b; }aType

1 Answers  


how to concatenate the two strings

1 Answers  


enum colors {BLACK,BLUE,GREEN} main() { printf("%d..%d..%d",BLACK,BLUE,GREEN); return(1); }

2 Answers  


Declare an array of N pointers to functions returning pointers to functions returning pointers to characters?

1 Answers  






Cau u say the output....?

1 Answers  


func(a,b) int a,b; { return( a= (a==b) ); } main() { int process(),func(); printf("The value of process is %d !\n ",process(func,3,6)); } process(pf,val1,val2) int (*pf) (); int val1,val2; { return((*pf) (val1,val2)); }

1 Answers   Satyam,


what is variable length argument list?

2 Answers  


void func1(int (*a)[10]) { printf("Ok it works"); } void func2(int a[][10]) { printf("Will this work?"); } main() { int a[10][10]; func1(a); func2(a); } a. Ok it works b. Will this work? c. Ok it worksWill this work? d. None of the above

1 Answers   HCL,


what will be the position of the file marker? a: fseek(ptr,0,SEEK_SET); b: fseek(ptr,0,SEEK_CUR);

2 Answers  


How can u say that a given point is in a triangle? 1. with the co-ordinates of the 3 vertices specified. 2. with only the co-ordinates of the top vertex given.

1 Answers  


write a c program to Reverse a given string using string function and also without string function

1 Answers  


Categories