Ask the user to enter their marks for 4 classes.
Traverse the array and display the students average
mark.
Using the above question and the program I have attached below,
write a program using Java in module programming while
implementing function type.
Thankyou
#include <iostream
using namespace std
int main() {
//declare an array
int marks[4],sum=0;
//take input and update su
for(int i=0;i<4;i++){
cout<<"Enter marks for class "<<
i+1<<": ";
cin>>marks;
sum+=marks;
}
//calculate average snd display on screen
double average= sum*1.0/4;
cout<<"Average: "<<average;
return 0;
}
#include <iostream>
using namespace std;
int main() {
//declare an array
int marks[4],sum=0;
//take input and update
sum
for(int
i=0;i<4;i++){
cout<<"Enter
marks for class "<< i+1<<": ";
cin>>marks;
sum+=marks;
}
//calculate average snd display
on screen
double average=
sum*1.0/4;
cout<<"Average:
"<<average;
return 0;
Ask the user to enter their marks for 4 classes. Traverse the array and display the students average mark. Using the ab
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Ask the user to enter their marks for 4 classes. Traverse the array and display the students average mark. Using the ab
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!