Code Program 6
Code Program 6
/Pr
ogra
mu nt
ukme l
i
hatni
l
aiakhi
rt
est
/
/Ni
l
aiAji
kani
la
idiat
as80,
Bj i
ka70<=ni
l
ai<
80
/
/Cji
ka50<=ni
lai
<70,Djik
a30< =ni
l
ai<
50
/
/Ej
ikani
l
ai<
30
#i
ncl
ude<i
os tr
ea m>
#i
ncl
ude<con i
o.h>
usi
ngname spac es td;
i
ntmain(
)
{
i
ntni
lai
;
c
out< <"Ma sukann i
l
a it
est"
;
c
in>>n il
ai
;
s
witch(nil
a i/10)
{
case10:
case9:
case8:
c out<<'A' <<
endl;
bre ak
;
case7:
c out<<'B' <
<endl;
break;
case6:
case5:
c out<<'C' <<
en dl
;
br eak
;
case4:
case3:
c out<<'D' <<
endl;
bre ak
;
case2:
case1:
case0:
c out<<'E'<<endl;
break;
default:
c out<<"Sa l
ah,ni
laidil
uarjangk
auan.
"<<endl
;
}
}
===
=========== = ===
=== =
= ===
= =
== ==========
======
======
===
===
===
===
===
===
===
===
===
===
===
==
#i
ncl
ude<i
os tr
ea m>
#i
ncl
ude<con i
o.h>
usi
ngname spac es td;
i
ntmain(
)
{
// clrs
cr()
;
f
l
o a
ts i
si,
pa n j
ang,
lebar,
ti
nggi,
j
a ri
,
volume,l
uas,
kel
i
li
ng;
i
ntpi
l;
c
out<<"=== == =
==PILI
HANPERHI TUNGAN= =
======
"<<e
ndl
;
c
out<<"1.v olumed anluask ubus "
< <
endl
;
c
out<<"2.v olumed anluasb alok"<
< endl
;
c
out<<"3.Ke l
il
i
ngda nluasli
ng kara
n "
<<endl
;
c
out<<"=== == =
====== ==
====== =======
=======
="<<
endl
;
c
out<<"ma s ukanpil
i
h an[1,
2,3]:";
c
in>>pi
l;
s
witch(pi
l)
{
case1:
c out<<"
=== =
==Me nuKubus =
====="
<<endl
;
c out<<"
pan j
angs i
si:";
c i
n>>sis
i;
volume =si
s i
*si
si
*sisi
;
l
u a s
=6*(si
s i
*s
isi
);
c out<<"
volume: "<<vol
ume <<endl
;
cout<<"l
ua s: "
<<luas;
break;
ca
se2:
cout<<"=== ===Me nuBa l
ok==
===="
<<endl
;
cout<<"pan ja
ng: ";
ci
n> >panjan g;
cout<<"l
eba r:";
ci
n> >l
eba r
;
cout<<"ti
ng gi:"
;
ci
n> >ti
nggi;
vol
ume =pa nj
ang* l
ebar*t
in
ggi
;
l
uas =2*((
pa njang*l
eba r
)+(
panj
ang*t
inggi
)
+(l
ebar
*t
in
ggi
)
);
cout<<"volume: "
<<volume<<endl
;
cout<<"l
ua s: "
<<luas<<endl
;
break;
ca
se3:
cout<<"=== =Men uLingkar
ang====
"<<endl
;
cout<<"j
a r
i-ja
ri:";
ci
n >
> j
ari
;l
uas=
3.14*
jar
i*
jar
i;
kel
il
ing=2*3.14*jari
;
cout<<"l
ua s: "
<<luas<<endl
;
cout<<"keli
li
ng: "<<
k e
li
li
ng;
break;
def
ault
:cout<<"pil
ihans a
lah";
br
eak;
}
}
============== ===
=======
======
====
= ==
===
===
===
===
===
===
===
===
===
===
===
===
===
===
===
===
===
===
#i
nclude<i
os tr
ea m>
#i
nclude<con i
o.h>
usi
ngn ame spac estd;
i
ntma i
n (
)
{
i
nta ;
f
o r
(a=0;
a< 10;
a++)
{
cout<<"
be l
ajarfor"
<<endl
;
}
}
============== ===
=======
======
====
= ==
===
===
===
===
=
#i
nclude<i
os tr
ea m>
usi
ngn ame spac estd;
i
ntma i
n (
)
{
inta=0;
wh i
l
e(a <5)
{
c out<<"bel
aj
arwh i
l
e"<
<endl
;a++;
}
}
============== ===
=======
======
====
= ==
===
===
===
===
===
===
#i
nclude<con i
o.h>
#i
nclude<ios t
ream>
usi
ngn ame spac estd;
i
ntma i
n (
)
{
inta,b;
for(
a=1 ;a< =10;a++)
{
c out< <"\n"
;
{
f
or(
b=a ;
b< =10;
b++)
{
cout<<a<<"";
}
}
}
ge
tch(
);
r
etur
n0;
}
===
===== =
= =========
===== ==
=====
===
====
===
===
===
===
===
===
=
#i
ncl
ud e<conio.
h>
#i
ncl
ud e<iostream>
usi
ngn ame spaces t
d;
i
ntma i
n()
{
i
ntloop=1;
do
cout< <loop++<<"";
wh i
l
e(loop< =10);
getch();
r
e t
urn0 ;
}
===
===== =
= =========
===== ==
=====
===
====
===
===
===
===
===
===
==
#i
ncl
ud e<i
os t
ream>
usi
ngn ame spaces t
d;
i
ntma i
n()
{
i
nta =1;
charu l
an gi
;
do
{
cout<<a
<<en dl
;a++;
cout<<"
ul
an gil
oopi
ng?:
";
cin>
>ulan
gi;
}
wh i
l
e(ul
angi
=='
y')
;
}
===
===== =
= =========
===== ==
=====
===
====
===
===
===
===
===
===
===
#i
ncl
ud e<iostream>
usi
ngn ame spaces t
d;
i
ntma i
n()
{
i
nti;
i
=0;
wh i
l
e( i<
10)
{
c out<<"C++"< <endl
;
i++;
}
}
===
===== =
= =========
===== ==
=====
===
====
===
===
===
===
===
===
===
===
==
#i
ncl
ud e<i
os t
ream>
usi
ngn ame spaces t
d;
i
ntma i
n()
{
i
nti;
i
=0;
do
{
c out<<"C++"< <e ndl
;
i
++;
}
whi
l
e(i
<10)
;
}
=======
=== =
=============
======
===
===
===
===
===
===
===
===
===
===
===
==
//Programme nce t
aka n
gka1-100
#in
clude<i
ostr
eam>
usi
ngn ame s
paces t
d ;
i
ntma i
n()
{
in
ti;
for
(i
=1;i<
=100;i++)
cout<<i <
<""< <endl
;
}
=======
=== =
=============
======
===
===
===
===
=
//Programme mbe ntuksegi
ti
ga
#in
clude<i
ostr
eam>
usi
ngn ame s
paces t
d ;
i
ntma i
n()
{
in
tti
nggi;
in
tbaris;
in
tkolom;
cout<<"Tinggisegi
ti
ga:"
;
ci
n> >ti
nggi;
c
out<<endl;
f
or(
bari
s=1;kol
om<=t i
nggi
;ba
ri
s++)
{
f
or(kol
om=1; kol
om< =bar
is
;kol
om++)
cout<<'*
';
cout<<e n
dl;
}
}
========
== =============
= =
=====
=====
===
===
===
===
===
===
===
===
=
//ProgramCon tin
ued anbreak
#in
clude<iostream>
usi
ngn ame spaces td;
i
ntma i
n()
{
in
ti;
for(
i=0;i<10;i
++)
{
if(i
== 4)cont
inue
;
c out<<"Bi l
angan"<<i<<e
ndl
;
if(i
== 6)bre
ak;
}
}
========
== =============
= =
=====
=====
===
===
===
===
===
===
===
===
=
#in
clude<i
os t
ream>
usi
ngn ame spaces td;
i
ntma i
n()
{
cout< <"Tesgot o"<<endl
;
gotos el
es ai
;
c
out<
<"Ha
i,s
ayak
okt
i
dakdi
sapa
"<<
endl
;
s
ele
sai:
c
out<<"Se
les
ai.
.
.
."<
<en
dl;
}
===
==============
=====
===
===
===
===
===
===
===
===
===
===
===
===
===
#i
ncl
ude<i
os t
ream>
#i
ncl
ude<con i
o.
h>
usi
ngname spacestd;
i
ntma i
n(
)
{
i
nti
;
i
=10;
whi
le(
i
> 0)
{
cout<<
i<<"";
i
--;
}
get
ch();
}
===
==============
=====
===
===
===
===
===
===
===
===
===
===
===
===
#i
ncl
ude<i
os t
rea m>
usi
ngname spac es t
d ;
i
ntmain(
)
{
f
or(
i
ntx=4; x>0; x--)
{
for(i
n ty=0; y<x ;y++)
{
cout< <endl;
}
}
}
===
=========== ===== ======= =
===========
=======
========
#i
ncl
ude<i
os t
rea m>
usi
ngname spac es t
d ;
i
ntmain(
)
{
i
nta,
ni
lai
[6]; f
or(a= 1;
a<=5;a++)
{
c out<< "
ma s ukann i
laikedal
ama rr
ayke-"
<<a<<
":"
;
c i
n>> nil
ai[
a];
}
c
out<<"=== ====== =================
=======
="<<
endl;
c
out<<"l
i
h ata rr
a ys ecarade s
c e
nding"
<<endl
;
f
or(
i
ntb =5;b> 0;
b- -)
{
c out<< "
isida ri
a r
rayk e-
"<<b<
<":"<<
nil
ai
[b]
<<endl
;
}
}
===
=========== ===== ======= =
===========
=======
========
===
#i
ncl
ude<stdio.h>
i
ntmain(
)
{
i
ntt
wo _dim[ 3][
5 ]={ 1,2,3,4,5,
10,20,30,40,
50,100
,200,300,
400,
500}
;
i
nti
,j
;
f
or(i
=0;i<3; i
++)
{
for(j= 0;j<
5; j++)printf
("
%6d "
,two_di
m[i
][
j]
);
pr i
ntf("\
n "
);
}
}
===
=========== ===== ======= =
===========
=======
========
====
==
#i
ncl
ude<iostream>
#i
ncl
ude<c oni
o.h>
usi
ngname s
pa cestd;
mai
n()
{
// clrsc
r();
i
ntA[3][2]={
{5,
3},{
10,
12}
,{
4,
5}};
f
or(i
ntb= 0;
b<3;b++)
{
for(i
ntc=0;c<
2;c
++)
{
cout<<"
A["
<<b
<<"]
["
<<c<
<"]:
"<<
A[b]
[c
]<<
endl
;
}
}
get
ch e(
);
r
eturn(0);
}