Write a program in c to print
the following output
For example, the no 5678 will be
displayed as
5678
678
78
8
Answers
Answered by
1
Answer:
idneneidne. roejenodkdn
Answered by
0
Answer:
#include<stdio.h>
void main(){
int num,temp,i=1,a;
printf("Enter the number:");
scanf("%d",&num);
temp=num;
temp=temp/10;
while(temp!=0){
temp=temp/10;
i*=10;
}
while(num!=0){
printf("%d\n",num);
a=num/i;
num=num-(a*i);
i/=10;
}
}
Explanation:
We will use the variable 'temp' to store the value of 'num' in order to know the number of digits entered by the user.
With the help of 'i' as many times it will be multiplied by 10 will show the number of digits entered.
Similar questions