Professional Documents
Culture Documents
CƠ SỞ LẬP TRÌNH
(CTĐTDB)
2024
Van Trung NGUYEN - Faculty of Information Technology
EXERCISES
Exercise 1:
import java.util.Scanner;
int a = scanner.nextInt();
int b = scanner.nextInt();
Exercise 2:
Programming basics 2
Van Trung NGUYEN - Faculty of Information Technology
import java.util.Scanner;
Exercise 3:
import java.util.Scanner;
boolean x = scanner.nextBoolean();
boolean y = scanner.nextBoolean();
Programming basics 3
Van Trung NGUYEN - Faculty of Information Technology
Exercise 4:
import java.util.Scanner;
int a = scanner.nextInt();
Exercise 5:
import java.util.Scanner;
Programming basics 4
Van Trung NGUYEN - Faculty of Information Technology
int a = scanner.nextInt();
int b = scanner.nextInt();
a += b; // a = a + b
a -= b; // a = a - b
Exercise 6: Let users enter a score of 3 subjects. Let's calculate the GPA and output
the results
import java.util.Scanner;
Programming basics 5
Van Trung NGUYEN - Faculty of Information Technology
Exercise 7: Let users enter value of a, b, c, d, e, g, h variables and output the results:
---END---
Programming basics 6