I need help with turning pseudo code into a simple module

Hello everyone,

I am new to programming and trying to take a flowchart into pseudo code then into a simple module based off that pseudo code. The module needs to accept parameter and return a value.

This is the pseudo code (I'm not even sure I have that formatted correctly)
1. sum = 0
2. count = 1
3. REPEAT
4. IF count is even THEN sum = sum + Count
5. count = count + 1
6. UNITIL count > 20
7. DISPLAY sum

I can send the flowchart that I think is correct, too.

Any help is greatly appreciated.
A "module" is called function. See http://www.cplusplus.com/doc/tutorial/functions/

Repeat..Until and If..Then are flow control constructs. See http://www.cplusplus.com/doc/tutorial/control/

Display is basic output. See http://www.cplusplus.com/doc/tutorial/basic_io/

Does this make sense at all? I'm trying, but I'm not sure I know what the heck I'm doing. Thanks for your help.

#include<iostream.h>
#include<conio.h>
void main()
{
      int total,sum(int);
      clrscr();
      total=sum(2);
      cout<<"Sum Of All Even Numbers From 0 To 20 : "<<total;
      getch();
}
        int sum(int i)
         {
            static int even=0;
            if(i<=20)
             {
                 even=even+i;
                 sum(i+2);
              }
            return even;
          }
Or this?

public class SumEvenNum {

public static void main (String[] arg)
{

int sum = 0;
for(int i = 1; i <= 200; i++)
{
if(i%2 == 0)
{
System.out.println("Summan blir : " + i);
sum = sum + i;

}
}
System.out.println("Sum : " + sum);
}
}
Topic archived. No new replies allowed.