Skip to content

Instantly share code, notes, and snippets.

@smyy96
Last active January 20, 2022 21:27
Show Gist options
  • Save smyy96/5c3310f0175bb71a8820f8eb1e945db6 to your computer and use it in GitHub Desktop.
Save smyy96/5c3310f0175bb71a8820f8eb1e945db6 to your computer and use it in GitHub Desktop.
Patika Java101 Dersi (Not Ortalaması Hesaplama) - Patika Java 101 Lesson (GPA Calculation)
package Giris;
import java.util.Scanner;
public class Baslangic {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int mathsGrade,physics,chemistry,turk,history,music;
int average=0;
System.out.print("Enter your math grade: ");
mathsGrade=input.nextInt();
System.out.print("Enter your physics grade: ");
physics=input.nextInt();
System.out.print("Enter your chemistry grade: ");
chemistry=input.nextInt();
System.out.print("Enter your turkish grade: ");
turk=input.nextInt();
System.out.print("Enter your history grade: ");
history=input.nextInt();
System.out.print("Enter your music grade: ");
music=input.nextInt();
average=(mathsGrade+physics+chemistry+turk+history+music)/6;
String status=(average>=60)? "Passed":"Failed";
System.out.print("Average: "+average +" "+ status);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment