Unit 1
Practical - 1
package pl;
import java.util.Scanner;
public class Pl {
public static void main(String[] args) {
float sum=0;
Scanner in =new Scanner(System.in);
float a[]= new float[6];
System.out.println("Enter marks of total six subjects :");
for(int i=0;i<6;i++)
{
a[i]=in.nextFloat();
sum = sum+a[i];
}
System.out.println("Percentage is :"+sum/6);
}
}
output:
Enter marks of total six subjects :
1 2 3 4 5 6
Percentage is :3.5
No comments:
Post a Comment