Addition program in a CPP Language

How to add Five numbers with Cpp programming?


#include <iostream>
#include<conio.h>
using namespace std;
int main ()
{
int foo [5] = {16, 2, 77, 40, 12071};
int n, result=0;
  for ( n=0 ; n<5 ; ++n )
  {
    result += foo[n];
  }
  cout << result;
getch();
}

Output Result


Comments

Popular posts from this blog

Even/Odd Number Checking Code in CPP

Calculating Name and Marks in Cpp

Triangle of Characters(CPP)