Write a program to input marks and calculate percentage and print result. ( JAVA )
// Write a program to input marks and calculate percentage and print result. ( JAVA )
package com.company; import java.util.Scanner; public class ResultCalculator { public static void main(String[] args) { // write your code here Scanner sc = new Scanner(System.in); System.out.println("Input your name:"); String name = sc.nextLine(); System.out.println("Input your class :"); byte Class = sc.nextByte(); System.out.println("Maximum marks : 100"); System.out.println("Input obtained marks of maths"); int maths = sc.nextInt(); System.out.println("Input obtained marks of physics"); int physics = sc.nextInt(); System.out.println("Input obtained marks of hindi"); int hindi = sc.nextInt(); System.out.println("Input obtained marks of english"); int english = sc.nextInt(); System.out.println("Input obtained marks of computer"); int computer = sc.nextInt(); double sum = maths + physics + hindi + english + computer; double percentage = (sum/500)*100; System.out.println("--------------------------------------------------------------"); System.out.println(" Result"); System.out.println("--------------------------------------------------------------"); System.out.println("Name : " + name); System.out.println("Class : " + Class); System.out.println("--------------------------------------------------------------"); System.out.println("SUBJECT MARKS OBTAINED MAXIMUM MARKS"); System.out.println("--------------------------------------------------------------"); System.out.println("MATHS " + maths + " 100 " ); System.out.println("PHYSICS " + physics + " 100 " ); System.out.println("HINDI " + hindi + " 100 " ); System.out.println("ENGLISH " + english + " 100 " ); System.out.println("COMPUTER " + computer + " 100 " ); System.out.println("--------------------------------------------------------------"); System.out.println(" " + sum + " 500.0"); System.out.println("--------------------------------------------------------------"); System.out.println("PERCENTAGE : " + percentage); System.out.println("--------------------------------------------------------------"); } // 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