#include <iostream>
#include <iomanip>
#include <conio.h>
using namespace std;
int i, tab[10], sum;
int main()
{
for (i = 0; i < 10; i++)
{
tab[i] = i + 1;
sum = sum + tab[i];
}
cout << "tab=";
for (i = 0; i < 10; i++)
cout << setw(3) << tab[i] << setw(2);
cout << endl;
cout << "SUM = " << sum << endl;
}
결과값
0 댓글