If input is 123 then how to print 100 and 20 and 3 seperately?
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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
Which is the best website to learn c programming?
How can I find leaf node with smallest level in a binary tree?
how to estimate the disk access time? e.g. the time between read one byte and another byte in the disk.
HOW CAN ADD OUR FUNCTION IN LIBRARY.
Is there anything like an ifdef for typedefs?
Why doesnt that code work?
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
c program to add and delete an element from circular queue using array
write a program to arrange the contents of a 1D array in ascending order
main() { enum _tag{ left=10, right, front=100, back}; printf("%d, %d, %d, %d", left, right, front, back); }
1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321