Write a Java program to print the result of the following operations

  • برمجة جافا
  • برمجة

Write a Java program to print the result of the following operations
Test Data:
a. -5 + 8 * 6
b. (55+9) % 9
c. 20 + -3*5 / 8
d. 5 + 15 / 3 * 2 - 8 % 3

Expected Output :
43
1
19
13

الأجوبة

public class Exercise4 {
 
 public static void main(String[] args) {
  System.out.println(-5 + 8 * 6);
  System.out.println((55+9) % 9);
  System.out.println(20 + -3*5 / 8);
  System.out.println(5 + 15 / 3 * 2 - 8 % 3);
 }
 
}

Sample Output:

43                                                                                                      
1                                                                                                      
19                                                                                                      
13

 

هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...