Print an integer using only putchar. Try doing it without
using extra storage.
Answers were Sorted based on User's Feedback
Answer / cmos
This can be done by recursion.
Since the number of recursive calls is not significant, it does not affect the performance much
printnumber(int i)
{
if(i == 0)
return;
printnumber(i/10);
putchar(’0′ + i%10);
}
Is This Answer Correct ? | 2 Yes | 4 No |
how to print 1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1 using any loop(for or while) only once(only 1 loop) and maximum 2 variables using C.
19 Answers Cap Gemini, Infosys,
void main() { static int i; while(i<=10) (i>2)?i++:i--; printf(“%d”, i); }
4. Main() { Int i=3,j=2,c=0,m; m=i&&j||c&I; printf(“%d%d%d%d”,I,j,c,m); }
PROG. TO PRODUCE 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates.
19 Answers Amazon, BITS, Microsoft, Syncfusion, Synergy, Vector,
Cluster head selection in Wireless Sensor Network using C programming language.
Is it possible to type a name in command line without ant quotes?
main() { int i=300; char *ptr = &i; *++ptr=2; printf("%d",i); }
void main() { static int i=i++, j=j++, k=k++; printf(“i = %d j = %d k = %d”, i, j, k); }
void main() { static int i=5; if(--i){ main(); printf("%d ",i); } }
#include<stdio.h> void fun(int); int main() { int a; a=3; fun(a); printf("\n"); return 0; } void fun(int i) { if(n>0) { fun(--n); printf("%d",n); fun(--n); } } the answer is 0 1 2 0..someone explain how the code is executed..?
Sorting entire link list using selection sort and insertion sort and calculating their time complexity
1 Answers Infosys, Microsoft, NetApp,