English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Using for loops, I'm supposed to do this...

Double the 2nd, 4th, 6th and 8th digits.
Then take nine away from each answer that is ten or more.

The digit is 514345917.
I just don't know how to get the 2nd, 4th, 6th and 8th digit.

I understand basic stuff like
for (i=0; i<10; i+=2)
printf("%d", i);
but I'm having trouble thinking of a way to get those digits. :(

Can someone help me? :)

2006-11-02 13:45:39 · 3 answers · asked by beelbe 1 in Computers & Internet Programming & Design

3 answers

It's best to start by writing an pseudo-algorithm such as:
1. Input a number
2. Assign the number a value in the Que
3. Last number? Then go to function of double.
4. Find 1st digit assigned value 2
5. Double it - is value +=10? Then double, if not ignore.
6. Do this for each one.

I know this is a pain, but you really need to work on your assignments by starting from the beginning. You'll be a better programmer in the long-run!

2006-11-02 13:51:12 · answer #1 · answered by Anonymous · 1 0

the func is clrscr() wish it replaced right into a typing blunders. It needs the the hedder report conio.h pattern #incorporate #incorporate void substantial() { cout<<"attempt string"; //reflects the text textile in expenses clrscr(); //clears the reveal and takes cursor to first line }

2016-10-21 04:25:55 · answer #2 · answered by Anonymous · 0 0

Hint, use an if...else if statement....

2006-11-02 14:43:38 · answer #3 · answered by D 4 · 0 0

fedest.com, questions and answers