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
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
main() { signed int bit=512, i=5; for(;i;i--) { printf("%d\n", bit >> (i - (i -1))); } } a. 512, 256, 0, 0, 0 b. 256, 256, 0, 0, 0 c. 512, 512, 512, 512, 512 d. 256, 256, 256, 256, 256
How will you print % character? a. printf(“\%”) b. printf(“\\%”) c. printf(“%%”) d. printf(“\%%”)
Extend the sutherland-hodgman clipping algorithm to clip three-dimensional planes against a regular paralleiepiped
write a c program to Create a mail account by taking the username, password, confirm password, secret_question, secret_answer and phone number. Allow users to register, login and reset password(based on secret question). Display the user accounts and their details .
main() { int i=300; char *ptr = &i; *++ptr=2; printf("%d",i); }
void main() { char far *farther,*farthest; printf("%d..%d",sizeof(farther),sizeof(farthest)); }
main(){ unsigned int i; for(i=1;i>-2;i--) printf("c aptitude"); }
#include<conio.h> main() { int x,y=2,z,a; if(x=y%2) z=2; a=2; printf("%d %d ",z,x); }
main() { int i=0; for(;i++;printf("%d",i)) ; printf("%d",i); }
Finding a number which was log of base 2
There is a lucky draw held every day. if there is a winning number eg 1876,then all possible numbers like 1867,1687,1768 etc are the numbers that match irrespective of the position of the digit. Thus all these numbers qualify fr the lucky draw prize Assume there is no zero digit in any numbers. write a program to show all the possible winning numbers if a "winning number"is passed as an arguments to the function.
C statement to copy a string without using loop and library function..