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 |
# include <stdio.h> int one_d[]={1,2,3}; main() { int *ptr; ptr=one_d; ptr+=3; printf("%d",*ptr); }
Write a program using one dimensional array to assign values and then display it on the screen. Use the formula a[i]=i*10 to assign value to an element.
1 Answers Samar State University,
Under linux environment can u please provide a c code for computing sum of series 1-2+3-4+5......n terms and -1+2-3+4-5...n terms..
struct Foo { char *pName; }; main() { struct Foo *obj = malloc(sizeof(struct Foo)); clrscr(); strcpy(obj->pName,"Your Name"); printf("%s", obj->pName); } a. Your Name b. compile error c. Name d. Runtime error
int i=10; main() { extern int i; { int i=20; { const volatile unsigned i=30; printf("%d",i); } printf("%d",i); } printf("%d",i); }
main ( ) { static char *s[ ] = {“black”, “white”, “yellow”, “violet”}; char **ptr[ ] = {s+3, s+2, s+1, s}, ***p; p = ptr; **++p; printf(“%s”,*--*++p + 3); }
main() { char not; not=!2; printf("%d",not); }
can you use proc sql to manpulate a data set or would u prefer to use proc report ? if so why ? make up an example and explain in detail
struct point { int x; int y; }; struct point origin,*pp; main() { pp=&origin; printf("origin is(%d%d)\n",(*pp).x,(*pp).y); printf("origin is (%d%d)\n",pp->x,pp->y); }
What is wrong with the following code? int *foo() { int *s = malloc(sizeof(int)100); assert(s != NULL); return s; }
could you please send the program code for multiplying sparse matrix in c????
programming in c lanugaue programm will errror error with two header file one as stdio.h and other one is conio.h