Tugas Algoritma Dan Pemograman 1 Semester 1 Modul 5.7 Atau 6.7
TUGAS ALGORITMA DAN PEMOGRAMAN SEMESTER 1 MODUL 5.7 ATAU 6.7
JUST SHARE
Jangan Lupa Follow @Pray_N_Win
Tugas 5.7.1
Jawaban :
#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();
}
Tugas 5.7.2
Jawaban :
#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);
n=(n*5);
cout<<n;
getch();
}
Tugas 5.7.3
Jawaban :
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
main()
{
int A,i,j,jum;
cout<<"input :";cin>>A;
for(i=2;i<=A;i+=2)
{
jum=0;
for(j=2;j<=i;j+=2)
{
if(j!=2)
cout<<"+";
cout<<j;
jum+=j;
}
cout<<"="<<jum<<endl;
}
cout<<endl;
getch();
}
Tugas 5.7.3
Jawaban :
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
main()
{
int A,i,j,jum;
cout<<"input :";cin>>A;
for(i=1;i<=A;i+=2)
{
jum=1;
for(j=1;j<=i;j+=2)
{
if(j!=1)
cout<<" * ";
cout<<j;
jum*=j;
}
cout<<"= "<<jum<<endl;
}
cout<<endl;
getch();
}
Jika ada kekurangan mohon komentar, saran, dan kritiknya
Terimakasih
JUST SHARE
Jangan Lupa Follow @Pray_N_Win
Tugas 5.7.1
Jawaban :
#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();
}
Tugas 5.7.2
Jawaban :
#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);
n=(n*5);
cout<<n;
getch();
}
Tugas 5.7.3
Jawaban :
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
main()
{
int A,i,j,jum;
cout<<"input :";cin>>A;
for(i=2;i<=A;i+=2)
{
jum=0;
for(j=2;j<=i;j+=2)
{
if(j!=2)
cout<<"+";
cout<<j;
jum+=j;
}
cout<<"="<<jum<<endl;
}
cout<<endl;
getch();
}
Tugas 5.7.3
Jawaban :
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
main()
{
int A,i,j,jum;
cout<<"input :";cin>>A;
for(i=1;i<=A;i+=2)
{
jum=1;
for(j=1;j<=i;j+=2)
{
if(j!=1)
cout<<" * ";
cout<<j;
jum*=j;
}
cout<<"= "<<jum<<endl;
}
cout<<endl;
getch();
}
Jika ada kekurangan mohon komentar, saran, dan kritiknya
Terimakasih