Write a program that prompts the user to input a four digit positive integer. The program then outputs the digits of the number, one digit per line. For example, if the imput is 3245, the output is:
3
2
4
5
any help is apreciated..i've been working on it but i cannot get it right.
Can somebody please helpe me with my assignment is C++ programming?
main()
{
int r;
int n=3245;
while(n%26gt;=0)
{
r=n%10;
n=n/10;
cout%26lt;%26lt;r%26lt;%26lt;'\n';
}
}
r will store the remainder when n is divided by 10.
n will become n/10 which is an integer as i have declared n to be an integer...
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment