write a programm to claculate %of marks of 40 student using function
Attachments:
helpls:
can u use arrays?
Answers
Answered by
2
In java :
import java.util.Scanner;
class Percentage
{
public static void main()
{
Scanner sc=new Scanner(System.in);
int I;
double s=0.0,m,p;
for(I=0;I<40;I++)
{
System.out.println("Enter the marks of the "+I+"student");
m=sc.nextDouble();
s+=m;
}
p=(double)s/40*100;
System.out.println("% is"+p);
}
}
import java.util.Scanner;
class Percentage
{
public static void main()
{
Scanner sc=new Scanner(System.in);
int I;
double s=0.0,m,p;
for(I=0;I<40;I++)
{
System.out.println("Enter the marks of the "+I+"student");
m=sc.nextDouble();
s+=m;
}
p=(double)s/40*100;
System.out.println("% is"+p);
}
}
Similar questions
India Languages,
8 months ago
Political Science,
8 months ago
Hindi,
8 months ago
Psychology,
1 year ago
Physics,
1 year ago
History,
1 year ago