i don't understand what is this program doing inspite of the explaination given. can you plz explain it in more and more detail such that i can understand?
content=// Program to accept a number x.
// Count number of digits in x and store it in n, form y that
// has the number of digits n at ten's place and the most
// significant digit of x at one's place.
// Display y. sample input: x= 16833, y = 51,
// since no.of digits of x is 5 and 1 is the msd of x.
#include
#include
main()
{
clrscr();
int x,y,z,i,n=0,num, msd, digit;
cout<<"Enter any number as x"<
cin>>x;
// computing number of digits.
num=x;
while(num>0)
{
digit=num%10;
n=n+1;
num=num/10;
}
msd=digit;
y=n*10+msd;
cout<<"The value of Y is "<
getch();
return 0;
}
2007-01-02
03:20:19
·
2 answers
·
asked by
simran m
1