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
What is a char c?
Do variables need to be initialized?
4-Take two sets of 5 numbers from user in two arrays. Sort array 1 in ascending and array 2 in descending order. Perform sorting by passing array to a function mySort(array, sortingOrder). Then multiply both the arrays returned from function, using metric multiplication technique in main. Print result in metric format.
How can I run c program?
What is c system32 taskhostw exe?
please explain clearly about execution of c program in detail,in which stage are the printf sacnf getting into exeecutable code
what will be maximum number of comparisons when number of elements are given?
What are global variables and how do you declare them?
Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
Write programs for String Reversal & Palindrome check
Why is it important to memset a variable, immediately after allocating memory to it ?
Why do we use int main instead of void main in c?
What are the different categories of functions in c?
What is #define size in c?
If errno contains a nonzero number, is there an error?