Aim:- Write a program that calculate percentage marks of the
student if marks of 6 subjects are given.
import
java.lang.*;
class
pra2
{
public static void main(String args[])
{
int m[]=new int[6];
int tot=0,pre;
for(int i=0;i<6;i++)
{
m[i]=Integer.parseInt(args[i]);
tot+=m[i];
}
pre=tot/6;
System.out.println("Presentage =
"+pre +"%");
}
}
Output:-
No comments:
Post a Comment