May 05


1. Latihan buatlah program untuk deret bilangan genap dari 10 sampai 50 kecuali 30
dengan menggunakan for, while, do while !

2. Buatlah program dengan menggunakan for bersarang dengan tampilan sbb:
[=============================================================]
1
2 4
3 6 9
4 8 12 16
5 10 15 20 25
6 12 18 24 30 36
7 14 21 28 35 42 49
8 16 24 32 40 48 53 64
9 18 27 36 45 54 63 72 81
10 20 30 40 50 60 70 80 90 100
[=============================================================]

The Answer below and Was Cr4ck3d – d(^_^)b

[=============================================================]
1.

#include<iostream.h>
void main()
{
for (int x=10; x<=50; x++)
{
if(x%2==0 && x!=30)
cout<<x<<endl;
}
}

===========================================================*
2.

#include <iostream.h>
#include <iomanip.h>
int main()
{
int x,y;
for (x=1;x<=10;x++)
{
for (y=1;y<=x;y++)
{
cout<<setw(4)<< x*y<<”";
}
cout<<”\n”;
}
return 0;
}

===========================================================*

Enjoy this Post!

Add to Mixx!

Random Posts




Leave a Reply