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 |
create a C program that displays one z,two y's,three x's until twenty six A's. plzz answer i need it tomorrow.
There are N egg baskets and the number of eggs in each basket is a known quantity. Two players take turns to remove these eggs from the baskets. On each turn, a player must remove at least one egg, and may remove any number of eggs provided they all belong to the same basket. The player picking the last egg(s) wins the game. If you are allowed to decide who is going to start first, what mathematical function would you use to decide so that you end up on the winning side? Upload a C program to demonstrate the behaviour of the game.
whats the use of header file in c?
How do you print an address?
can we store values and addresses in the same array? explain
What are the types of arrays in c?
#define min((a),(b)) ((a)<(b))?(a):(b) main() { int i=0,a[20],*ptr; ptr=a; while(min(ptr++,&a[9])<&a[8]) i=i+1; printf("i=%d\n",i);}
what does data structure mean?
What is the size of structure in c?
What is the purpose of sprintf?
What is the purpose of 'register' keyword in c language?
SRUCTURE PROGRAMMING