latihan 1. #include<stdio.h> #include
#include #include<math.h> void main() {int bil1,bil2,has_or,has_and,has_xor,ges_kr,ges_kn; cout<<"masukkan bil pertama : ";cin>>bil1; cout<<"masukkan bil kedua : ";cin>>bil2; has_or=bil1 | bil2 ; has_and=bil1 & bil2; has_xor=bil1^bil2; cout<<"bil1 di orkan bil2 = "<>bil1; cout<<"bitnya digeser : ";cin>>bil2; ges_kr=bil1<>bil2; cout< void main() {int a,b,x,y,c; cout<<"masukan bil. 1 :";cin>>a; cout<<"masukan bil. 2 :";cin>>b; cout<<"berapa kali pengulangan :";cin>>x; cout<
"<
for(y=1;y<=x-2;y++) {c=a+b; cout<
";
";
latihan 3. #include<stdio.h rel="nofollow"> #include #include #include<math.h> void main() { clrscr(); int f1,f2,sd1,sd2; float f1x,f2x,f1y,f2y,R; cout<<"masukkan gaya pertama : "; cin>>f1; cout<<"sudut terhadap horizontal : "; cin>>sd1; cout<<"masukkan gaya kedua : "; cin>>f2; cout<<"sudut terhadap horinzontal : "; cin>>sd2; f1x=f1*cos(sd1*3.14/180); f1y=f1*sin(sd1*3.14/180); f2x=f2*cos(sd2*3.14/180); f2y=f2*sin(sd2*3.14/180); R=sqrt(pow(f1x+f2x,2)+pow(f1y+f2y,2)); cout<<"nilai resultan gaya adalah : "< #include void main() {int jr,rs; float r[100], rp; cout<<"input jumlah resistor:"; cin>>jr; rs=0;rp=1; for(int a=1;a<=jr;a+=1) {cout<<"input nilai resistor ke:"<>r[a]; cout<>bil1; cout<<"masukkan bilangan kedua :";cin>>bil2; has_or = bil1 | bil2 ; has_and = bil1 & bil2 ; has_xor = bil1 ^ bil2 ; cout<<"bil1 diorkan bil2 ="<
=";cin>>bil1;
=";cin>>bil2;
ges_kr=bil1<>bil2; cout<<"bitnya digeser kekiri sebanyak ="<
Latihan. #include<stdio.h> #include #include #include<math.h> void main() { clrscr ; int bil1,bil2,hasil_or,hasil_and; cout<<"masukan bilangan pertama :";cin>>bil1; cout<<"masukan bilangan kedua :";cin>>bil2; hasil_or = bil1 | bil2; hasil_and = bil1 & bil2; cout<<"bil1 diorkan bil2 ="<