If input is 123 then how to print 100 and 20 and 3 seperately?

Answer Posted / letskools

#include<stdio.h>
#include<conio.h>
void main()
{
int a[5];
int i, j,rem,k=0,x=1;
int num;
printf("enter any number");
scanf("%d",&num);
while(num>0)
{
rem = num % 10;
a[k] = rem * x;
x *= 10;
k++;
num /= 10;
}
for (i = k-1; i >= 0; i--)
{
printf("%d\n"a[i]);
}
getch();
}

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write the program that calculates and prints the average of several integers. Assume that the last value read is sentinel 9999.

3125


Is c dynamically typed?

667


Can you write the function prototype, definition and mention the other requirements.

662


What are the 32 keywords in c?

637


Explain what are the different file extensions involved when programming in c?

633






Explain the use of bit fieild.

715


Explain what is operator promotion?

637


Why isnt there a numbered, multi-level break statement to break out

589


What is hashing in c?

644


What is the meaning of ?

622


a single linked list consists of nodes a to z .print the nodes in reverse order from z to a using recursion

2334


What oops means?

584


What is the role of && operator in a program code?

568


The purpose of this exercise is to benchmark file writing and reading speed. This exercise is divided into two parts. a). Write a file character by character such that the total file size becomes approximately >10K. After writing close the file handler, open a new stream and read the file character by character. Record both times. Execute this exercise at least 4 times b). Create a buffer capable of storing 100 characters. Now after generating the characters, first store them in the buffer. Once the buffer is filled up, store all the elements in the file. Repeat the process until the total file size becomes approximately >10K.While reading read a while line, store it in buffer and once buffer gets filled up, display the whole buffer. Repeat the exercise at least 4 times with different size of buffer (50, 100, 150 …). Records the times. c). Do an analysis of the differences in times and submit it in class.

1635


Why is c fast?

606