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

Answer Posted / raghuram.a

#include <stdio.h>
#include<conio.h>
void putlong(unsigned long x)
{
if (x>=10)
{
putlong(x/10);
}
putchar(x%10+48);
}
main()
{
unsigned long a;
clrscr();
printf("enter long integer:");
scanf("%ld",&a);
putlong(a);
getch();
return 0;

}

Is This Answer Correct ?    12 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

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

3037


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

1258


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 ??

2084


How to palindrom string in c language?

9620


create a C-code that will display the total fare of a passenger of a taxi if the driver press enter,the timer will stop. Every 10 counts is 2 pesos. Initial value is 25.00

6531






Write a program to model an exploding firecracker in the xy plane using a particle system

3834


why do you use macros? Explain a situation where you had to incorporate macros in your proc report? use a simple instream data example with code ?

2460


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

3094


Design an implement of the inputs functions for event mode

3125


write a program for area of circumference of shapes

2194


why nlogn is the lower limit of any sort algorithm?

2512


Hi, i have a project that the teacher want a pyramid of numbers in C# or java...when we click a button...the pyramid should be generated in a listbox/or JtextArea...and the pyramid should have the folowing form: 1 232 34543 4567654 567898765 67890109876 7890123210987 890123454321098 90123456765432109 0123456789876543210 Plz help with codes...didn't find anything on the net.

2858


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

3341


how to test pierrot divisor

2429


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

3324