2-d array problem
i can't put more i/p value after puttng jst ist input..i tried for a = 3 n b = 5..jst 1 i/p is recieve(i.e. only i loop is running 1 times)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#include <iostream>
using namespace std;
int main()
{
int mult = 1;
int sum[100000];
sum[0] = 0;
int ar[100000][3];
int a,b,i,c = 0;
cin >> a;
while ( c < a )
{
cin >> b;
for (int j = 0; j < b; j++)
{
for (i = 0; i < 3; i++)
{
cin >> ar[j][i];
cout << ar[j][i] << endl;
mult = ar[j][i] * mult;
cout << "val = " << mult << endl;
}
sum[j] = sum[j] + mult / ar[j][i] ;//problem is here its not printing .
cout << "sum" << sum[j] << endl;
}
c++;
}
for (i = 0; i < a; i++)
{
cout << sum[i] << endl;
}
}
|
What does this program do?
Topic archived. No new replies allowed.