int arr[10];double sum=0;

for(int i=0;i<10;i++)

{

cin>>arr[i];

sum=sum+arr[i];

}

sum=sum/10;

cout<<"Average of 10 students is "<<sum<<endl;

0 votes

for(int i=0;i<10;i++)

{

cin>>arr[i];

sum=sum+arr[i];

}

sum=sum/10;

cout<<"Average of 10 students is "<<sum<<endl;

0 votes

#include <stdio.h>

/**

* Code to work out average of results from 10 students entered

*/

int main(){

/*

result and sum can be float etc for more precision since

if results can be .25 and sum could be a decimal result as a result

*/

int counter, result[10], sum;

double avg; // double for precision

//For loop to enter scores for 10 students, and work out sum on each pass

for(counter = 0; counter < 10; counter++){

printf("Please enter result for student %d: ", counter+1);

scanf("%d", &result[counter+1]);

//sum = current sum value + value in array

sum +=result[counter+1];

}

avg = (double)sum / (double)10; //typecast for precision. Not required necessarily

printf("Average result is %f", avg);

return 0;

}

/**

* Code to work out average of results from 10 students entered

*/

int main(){

/*

result and sum can be float etc for more precision since

if results can be .25 and sum could be a decimal result as a result

*/

int counter, result[10], sum;

double avg; // double for precision

//For loop to enter scores for 10 students, and work out sum on each pass

for(counter = 0; counter < 10; counter++){

printf("Please enter result for student %d: ", counter+1);

scanf("%d", &result[counter+1]);

//sum = current sum value + value in array

sum +=result[counter+1];

}

avg = (double)sum / (double)10; //typecast for precision. Not required necessarily

printf("Average result is %f", avg);

return 0;

}

0 votes

#include <stdio.h>

#include<conio.h>

#include <stdio.h>

main()

{

char arr[10];

double avg=0;

int sum=0;

for(int i=1;i<=10;i++)

{

printf("Enter %dth sutadnt marks: ",i);

scanf("%s",&arr[i]);

sum=sum+arr[i];

}

avg=sum/10;

printf("Average of 10 students is %g\n",avg);

}

#include<conio.h>

#include <stdio.h>

main()

{

char arr[10];

double avg=0;

int sum=0;

for(int i=1;i<=10;i++)

{

printf("Enter %dth sutadnt marks: ",i);

scanf("%s",&arr[i]);

sum=sum+arr[i];

}

avg=sum/10;

printf("Average of 10 students is %g\n",avg);

}

0 votes

#include <stdio.h>

#include<conio.h>

main()

{

char arr[10];

double avg=0;

int sum=0;

for(int i=1;i<=10;i++)

{

printf("Enter %dth sutadnt marks: ",i);

scanf("%s",&arr[i]);

sum=sum+arr[i];

}

avg=sum/10;

printf("Average of 10 students is %g\n",avg);

}

#include<conio.h>

main()

{

char arr[10];

double avg=0;

int sum=0;

for(int i=1;i<=10;i++)

{

printf("Enter %dth sutadnt marks: ",i);

scanf("%s",&arr[i]);

sum=sum+arr[i];

}

avg=sum/10;

printf("Average of 10 students is %g\n",avg);

}

0 votes

**#include <stdio.h>**

**int main(){ int a[10],i,sum=0; for(i=1;i<=10;i++) { printf("enter marks of student %d\n",i); scanf("%d",&a[i]); sum=sum+a[i]; } float average =sum/10.0; printf("avgerage marks of 10 students =%.2f\n",average); return 0;}**

0 votes

import java.util.Scanner;

public class Main

{

public static void main(String[] args)

{

int n, d = 0;

int avg = 0;

Scanner s = new Scanner(System.in);

System.out.println("Please enter 10:");

n = s.nextInt();

int Array[] = new int[n];

for (int i=0; i<n; i++)

{

Array[i] = s.nextInt();

d = d + Array[i];

}

avg = d / n;

System.out.println("Average:"+avg);

}

}

public class Main

{

public static void main(String[] args)

{

int n, d = 0;

int avg = 0;

Scanner s = new Scanner(System.in);

System.out.println("Please enter 10:");

n = s.nextInt();

int Array[] = new int[n];

for (int i=0; i<n; i++)

{

Array[i] = s.nextInt();

d = d + Array[i];

}

avg = d / n;

System.out.println("Average:"+avg);

}

}

...