0

What's the wrong... This code c++ for arrays determine average of degrees for 150 student!!!?????

#include<iostream> using namespace std; int main( ) int student [150],sum=0,n; cin>>n; for (int i=1;i<=n;i++;) { for(int k=0;k<=149;k++) { cin>>student[k]; sum+=student[k]; } } cout<<"the average="<<(flout)sum/7; if(sum>average) cout<<"pass"; else cout<<"fail";

19th Dec 2021, 9:52 PM
Mohamed Elamin
Mohamed Elamin - avatar
2 ответов
+ 2
Off just glancing at it, i can see you typecast "flout" instead of "float" when you print the average.
19th Dec 2021, 10:10 PM
Slick
Slick - avatar