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

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / charusheela

#include<stdio.h>
#include<conio.h>
void main(){
int num=123,r,i=1;
clrscr();
while(num)
{
r=num%10;
printf("%d\n",r*i);
i*=10;
num/=10;
}
getch();
}

Is This Answer Correct ?    2 Yes 0 No

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

Answer / dhruv sharma rkdf

#include<stdio.h>
#include<conio.h>
void main(){
int n,temp,i=1;
clrscr();
printf("enter number:");
scanf("%d",&n);
for(;n>0;n=n/10){
temp=(n%10)*i;
i*=10;
printf("%d\n",temp)
}
getch();
}

Is This Answer Correct ?    1 Yes 0 No

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

Answer / cute_boy4434

PLz reply me soon . ya

Is This Answer Correct ?    3 Yes 3 No

Post New Answer

More C Interview Questions

What does a derived class inherit from a base class a) Only the Public members of the base class b) Only the Protected members of the base class c) Both the Public and the Protected members of the base class d) .c file

0 Answers  


Which is the best website to learn c programming?

0 Answers  


How can I find leaf node with smallest level in a binary tree?

1 Answers  


how to estimate the disk access time? e.g. the time between read one byte and another byte in the disk.

3 Answers   Google,


HOW CAN ADD OUR FUNCTION IN LIBRARY.

5 Answers  






Is there anything like an ifdef for typedefs?

0 Answers  


Why doesnt that code work?

0 Answers  


Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......

0 Answers  


c program to add and delete an element from circular queue using array

3 Answers  


write a program to arrange the contents of a 1D array in ascending order

4 Answers  


main() { enum _tag{ left=10, right, front=100, back}; printf("%d, %d, %d, %d", left, right, front, back); }

1 Answers   Accenture, Vector,


1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321

0 Answers  


Categories