Pages

Saturday, January 17, 2015

A Example of "if else" loop

Here i'm going to give you an example of of "if else" loop to write a program on 

FIND THE TOTAL MARKS AND PERCENTAGE OF AA STUDENT IN 5 SUBJECTS 



class student 

{
  public static void main(string args[]);

  {
    int a,b,c,d,e,t;  
    float p;

a= Integer.parseInt(args[0]);
b= Integer.parseInt(args[1]);
c= Integer.parseInt(args[2]);
d= Integer.parseInt(args[3]);
e= Integer.parseInt(args[4]);

t=(a+b+c+d+e);

system.out.println("total marks are" +t);
p=(t/500)*100;
system.out.println("percentage is " +p);
if (p>=4)
{
system.out.println("student is passed");
}
else
 {
   system.out.println("student failed"); 
 }
}
}










No comments:

Post a Comment