cplusplus.com cplusplus.com
cplusplus.com   C++ : Forums : Beginners : Hey guys can u pls help me out last 1 i ...
  Search:
- -
C++
Information
Documentation
Reference
Articles
Sourcecode
Forums
Forums
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Articles
Lounge
Jobs

-

question  Hey guys can u pls help me out last 1 i promise

Roofio (9)
hey guys
thanks for your help so far,
just need sum with this 1

Write a C++ program with a loop structure that reads in 5 integers one by one, calculate the sum of the values that are multiples of 3 and display the final result.

thanks
|
Hotaru (31)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// pseudocode = yes
// Like perl people say, there's more than 1 way to do it
// and I used multiple loops

int myints[4],mysum
short i

for ( i=0,4,i++)
cin >> myints[i]

mysum = 0
for ( i=0,4,i++)
mysum = mysum + myints[i]
cout << mysum

for ( i=0,4,i++)
if (myints[i] % 3 == 0) cout << i "," myints[i]

|

This topic is archived - New replies not allowed.
Home page | Privacy policy
© cplusplus.com, 2000-2008 - All rights reserved - v2.2
Spotted an error? contact us