how to enter 3-digit numbers with c++

how we can separate the components in units of numbers that Palin first we do is do it or make a good CRA algorithm first.

how algorithm

1.masukan 3-digit numbers

2.jika 3-digit number less than 100 and 3 digits more than 999 repeat langklah 1

3.jika 3-digit number over 100 and 3 digits less than 999 continue langklah 4

4.hitung each in the form of hundreds, tens and units

hundred = input / 100;
tens = (input-hundred * 100) / 10;
sa = input - hundreds * 100 - tens * 10;

if we implement in the programming language, on this blog using C + +

# include

main ()
{
int input, hundred, fifty, sa;
original:
<<"====================================="<< court endl;
court <<"| http://p4rtzone.blogspot.com/ |" < court <<"| Enter as many as 3 Digit Number |" < <<"====================================="<< court endl;
cin>> input;
if (input <100 | | input> 999) goto beginning;
hundred = input / 100;
tens = (input-hundred * 100) / 10;
sa = input - hundreds * 100 - tens * 10;

<<"====================================="<< court endl;
court <<"|" <<<"hundreds="" +"="" <<<"tens="" <<<"units"="" <<"|"="" < <<"====================================="<< court endl;

return 0;
}


0 comments:

Twitter Delicious Facebook Digg Favorites More