Write a program to find out wether a student is pass or fail, if it requires total of 40% marks to pass and at least 33% in each subject to pass. Assume three subject as an input from user. ( #JAVA )
Check another logic for the same program :
/*
Write a program to find out wether a student is pass or fail, if it requires total of 40% marks to pass and at least 33% in each subject to pass. Assume three subject as an input from user. ( #JAVA )
*/
package com.company;
import java.util.Scanner;
public class PassingResult
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
System.out.println(“Input marks of Subject 1 :”);
float s1 = sc.nextFloat();
System.out.println(“Input marks of Subject 2 :”);
float s2 = sc.nextFloat();
System.out.println(“Input marks of Subject 3 :”);
float s3 = sc.nextFloat();
float sum = s1 + s2 + s3;
float percentage = (sum/300)*100;
System.out.println(“Total marks obtained : ” + sum);
System.out.println(“Percentage ” + percentage);
// Logic
if( s1 >= 33 && s2 >= 33 && s3 >= 33 )
{
if (percentage >= 40)
{
System.out.println(“PASS”);
}
else
{
System.out.println(“FAIL”);
}
}
else
{
System.out.println(“FAIL”);
}
}Β Β // end of mains
}Β Β // end of class
Thanks Dosto for Reading this blog.
I think you all are definitely thinking of being connected with me.
ππ»Β InstagramΒ :Β https://www.instagram.com/thetechdcode/
ππ»Β Facebook PageΒ :Β https://www.facebook.com/thetechdcode
ππ»Β TwitterΒ :Β https://twitter.com/thetechdcode
ππ»Β TelegramΒ ChannelΒ :Β https://t.me/thetechdcode
ππ»Β YouTubeΒ :Β https://www.youtube.com/channel/UCjJnEdeugftBwQ3yMuD4B_A
ππ»Β Tech DCode LinktreeΒ :Β https://linktr.ee/thetechdcode
ππ»Β My Personal HandlesΒ :Β https://linktr.ee/virtualshivamin
π§βπ»π§βπ»Β Social Media Links of SHIVAM SINGH (OWNER) :
ππ»Β InstagramΒ :Β https://www.instagram.com/virtualshivamin/
ππ»Β Facebook PageΒ :Β https://www.facebook.com/virtualshivamin/
ππ»Β TwitterΒ :Β https://twitter.com/virtualshivamin/
ππ»Β Personal LinktreeΒ :Β https://linktr.ee/virtualshivamin
π€π€Β Check Best Offers/Deals and Discount on Amazon :
πΒ AmazonΒ :Β https://amzn.to/3tLt2FN
πΒ BestsellersΒ :Β https://amzn.to/31boSuB
πΒ New RealeasesΒ :Β https://amzn.to/3rdru5U
πΒ Movers and ShakersΒ :Β https://amzn.to/3lFu5nY
πΒ Computer and accessories :Β https://amzn.to/3lERTbJ
πΒ ElectronicsΒ :Β https://amzn.to/3sqHW4l
πΒ SoftwaresΒ :Β https://amzn.to/3ccwAee