Program
import
java.util.Scanner;
public
class _tugas_pemrograman3
{
public static void main ( String[]feri)
{
Scanner sc= new Scanner(System.in);
int a,b,c,h,w,x,y;
double o, z;
boolean d,e,f = true;
boolean g =false;
String nama, npm;
System.out.println(" \tTUGAS
PEMROGRAMAN 3 ");
System.out.println();
System.out.print("masukkan nama =
");
nama=sc.nextLine();
System.out.print("masukkan npm =
");
npm=sc.nextLine();
System.out.print("masukkan nilai
A = ");
a=sc.nextInt();
System.out.print("masukkan nilai
B = ");
b=sc.nextInt();
System.out.println();
w=a+b;
x=a-b;
y=a*b;
z=a/b;
o=a%b;
c=a--;
h=b++;
d=(a>5) & (b>5);
e=(a>5) | (b>5);
f=(a>5) ^ (b>5);
System.out.println(" A == B = " +( a == b));
System.out.println(" A != B = " +( a != b));
System.out.println(" A > B = " +( a > b));
System.out.println(" A < B = " +( a < b));
System.out.println(" A >= B = " +( a >= b));
System.out.println(" A <= B = " +( a <= b));
System.out.println(" A + B = " +w);
System.out.println(" A - B = " +x);
System.out.println(" A * B = " +y);
System.out.println(" A / B = " +z);
System.out.println(" A % B = " +o);
System.out.println(" A++ = " +(++a));
System.out.println(" A-- = " +(--c));
System.out.println(" --B = " +(--b));
System.out.println(" ++B = "
+(++h));
System.out.println(" A & B = " +d);
System.out.println(" A | B = " +e);
System.out.println(" A ^ B = " +f);
System.out.println(" ! B = " +g);
System.out.println(" ! A = " +g);
}
}
Tidak ada komentar:
Posting Komentar