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 |
main() { void swap(); int x=10,y=8; swap(&x,&y); printf("x=%d y=%d",x,y); } void swap(int *a, int *b) { *a ^= *b, *b ^= *a, *a ^= *b; }
# include <stdio.h> int one_d[]={1,2,3}; main() { int *ptr; ptr=one_d; ptr+=3; printf("%d",*ptr); }
main() { int x=5; clrscr(); for(;x==0;x--) { printf("x=%d\nā", x--); } } a. 4, 3, 2, 1, 0 b. 1, 2, 3, 4, 5 c. 0, 1, 2, 3, 4 d. none of the above
main() { int i; clrscr(); for(i=0;i<5;i++) { printf("%d\n", 1L << i); } } a. 5, 4, 3, 2, 1 b. 0, 1, 2, 3, 4 c. 0, 1, 2, 4, 8 d. 1, 2, 4, 8, 16
Develop a routine to reflect an object about an arbitrarily selected plane
Write a c program to search an element in an array using recursion
void main() { void *v; int integer=2; int *i=&integer; v=i; printf("%d",(int*)*v); }
Write a program that find and print how many odd numbers in a binary tree
void ( * abc( int, void ( *def) () ) ) ();
Sir... please give some important coding questions asked by product companies..
main() { char string[]="Hello World"; display(string); } void display(char *string) { printf("%s",string); }
Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.