Buatlah program untuk menghitung 10 deret bilangan genap dengan hasilnya :
2 + 4 + 6 + 8 + 10 + 12 + 14 + 16 + 18 + 20 = 110
#include<iostream.h>
#include<conio.h>
main()
{
int a=2,b=20,n;
for(a=a;a<=b;a+=2)
{
cout<<a;
if(a<b)
{
cout<<" + ";
}
}
cout<<" = ";
n=b/2;
n=n*(n+1);
cout<<n;
getch();
}
Buatlah program untuk menghitung 10 deret bilangan ganjil dengan hasilnya :
1 + 3 + 5 + 7 + 9 + 11 + 13 + 15 + 17 + 19 = 100
#include<iostream.h>
#include<conio.h>
main()
{
int a=1,b=19,n;
for(a=a;a<=b;a+=2)
{
cout<<a;
if(a<b)
{
cout<<" + ";
}
}
cout<<" = ";
n=(b+1)/2;
n=n*n;
cout<<n;
getch ();
}
Buatlah program untuk menghitung penjumlahan deret bilangan membentuk segitiga siku dengan hasilnya :
1 = 1
1 + 2 = 3
1 + 2 + 3 = 6
1 + 2 + 3 + 4 = 10
1 + 2 + 3 + 4 + 5 = 15
#include<iostream.h>
#include<conio.h>
main()
{
int A,i,j,jum;
for (i=1;i<=4;i++)
{
jum=0;
for (j=1;j<=i;j++)
{
if (j != 1)
cout<<"+";
cout<<j;
jum +=j;
}
cout<<"\t\t= "<<jum<<endl;
}
for (i=5;i==5;i++)
{
jum=0;
for (j=1;j<=i;j++)
{
if (j != 1)
cout<<"+";
cout<<j;
jum +=j;
}
cout<<"\t= "<<jum<<endl;
}
getch();
}
7 comments:
good information ... I have read and will be added to my personal knowledge... thanks
nice post gan...
oya boleh tukeran link??ini link saya
http://blog.umy.ac.id/ghea
kalo sudah terpasang kabarin yah gan..thx
keren mas bro,thanks ya,tugas ane udah kelar jadinya
thanks banget
mkasi mas bro'
buat skrang cma bisa copas dulu, mg some time bisa bkin prog sendiri...
We've got an unbelievable wealth of franchises and content that we can create to put on places like Disney+ or in movie theaters. So, really, our strength in the past is our strength in the future. And that's what will drive us to that restoration of the magic. And so, I'm bullish about the future. I'm extremely bullish about the Walt Disney Company and its ability and its mission to create those magical memories that last a lifetime.
https://www.betting33.com
Makasih
satu yg salah kak nggak bisa masuk
Post a Comment
Jangan lupa ninggalin jejak dengan komentar ^_^