Given only putchar (no sprintf, itoa, etc.) write a routine
putlong that prints out an unsigned long in decimal.

Answer Posted / prateek caire

void print(unsigned n)
{
static c = 0;
if( n < 10)
{
putchar(n + 48);
return;
}
int m = n%10;
print(n/10);
if(++c%3 == 0) putchar(',');
putchar(48 + m);
}

Is This Answer Correct ?    7 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. String contains only lowercase characters ['a'-'z']

481


Write a routine to implement the polymarker function

4364


What is full form of PEPSI

1846


Cluster head selection in Wireless Sensor Network using C programming language.

3090


Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange

2845






write a simple calculator c program to perform addition, subtraction, mul and div.

3126


#include int main(void) { int a=4, b=2; a=b<>2 ; printf("%d",a); return 0; }

1052


write a c program to input initial & final time in the format hh:mm and find the time intervel between them? Ex inputs are initial 06:30 final 00:05 and 23:22 final 22.30

2210


How can you relate the function with the structure? Explain with an appropriate example.

2903


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

2309


Write a Program in 'C' To Insert a Unique Number Only. (Hint: Just Like a Primary Key Numbers In Database.) Please Some One Suggest Me a Better Solution for This question ??

1761


write a function to give demostrate the functionality of 3d in 1d. function prototye: change(int value,int indexX,int indexY,int indexZ, int [] 1dArray); value=what is the date; indexX=x-asix indexY=y-axis indexZ=z-axis and 1dArray=in which and where the value is stored??

4122


Sir... please give some important coding questions asked by product companies..

1781


Design an implement of the inputs functions for event mode

2946


why nlogn is the lower limit of any sort algorithm?

2360