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

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 ?

2266


What is data _null_? ,Explain with code when u need to use it in data step programming ?

2828


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

3697


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

2228


What is full form of PEPSI

1873






Write a routine to implement the polymarker function

4388


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

1784


How do you verify if the two sentences/phrases input is an anagram using predefined functions in string.h and by using arrays?

2032


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

2923


how to create a 3x3 two dimensional array that will give you the sums on the left and bottom columns

3129


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.

2693


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

4151


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

2340


Design an implement of the inputs functions for event mode

2970


how to test pierrot divisor

2264