TUGAS PERTEMUAN 6 ALGORITMA DAN STRUKTUR DATA
Assalamu'alaikum Wr.Wb
Lampiran Tugas Algoritma Dan Struktur Data
Nama : Raihan Ramadhan
NIM : 3420210009
Prodi : Teknik Informatika
LAMPIRAN TUGAS 1
Program 1
Script Tugas 1
/*------------------------------*/
/* Program For - Bilangan Naik */
/*------------------------------*/
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
//Nama : Raihan Ramadhan
//Nim : 3420210009
//Prodi : Teknik Informatika
void main ()
{
int a;
for (a=60;a<=69;a++)
{
cout<<"Ini Adalah Baris Ke - " <<a<<endl;
}
getch ();
}
LAMPIRAN TUGAS 2
Program 2
Script Tugas 2
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
//Nama : Raihan Ramadhan
//Nim : 3420210009
//Prodi: Teknik Informatika
void main () {
puts ("-----------------------------");
puts (" Program For Bersarang" );
puts ("-----------------------------");
int a,b;
for (a=4;a<=9;a++) {
for (b=2;b<=2;b++) {
printf("Algoritma Dan Struktur Data \n");
cout<<endl;
}
}
getch();
}
LAMPIRAN TUGAS 3
Program 3
Script Tugas 3
#include <iostream.h>
#include <stdio.h>
#include <conio.h>
//Nama : Raihan Ramadhan
//NIM : 3420210009
//Prodi : Teknik Informatika
void main()
{
int a,b;
for (a=3;a<=9;a++)
{
printf("\n");
for(b=a;b<=9;b++)
{
printf("%d",a);
}
}
getch();
}
LAMPIRAN TUGAS 4
Program 4
Script Tugas 4
#include <iostream.h>
#include <stdio.h>
#include <conio.h>
//Nama : Raihan Ramadhan
//NIM : 3420210009
//Prodi : Teknik Informatika
void main()
{
int a,b;
char lagi;
atas:
clrscr();
cout<<"Masukkan Bilangan = ";cin>>a;
b = a % 2;
printf("Nilai %d %% 2 adalah = %d",a, b);
printf("\n\nIngin Hitung Lagi [Y/T] : ");
lagi = getche();
if (lagi == 'Y' || lagi == 'y') { goto atas; }
getch();
}
LAMPIRAN TUGAS 5
Program 5
Script Tugas 5
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
//Nama : Raihan Ramadhan
//Nim : 3420210009
//Prodi: Teknik Informatika
void main ()
{
int bil = 1;
while (bil<=10)
{
printf (" %d ",bil);
bil++;
}
bil = 3;
cout<<endl;
do
{
printf (" %d ",bil);
bil+=2;
} while (bil <=10);
getch();
}
LAMPIRAN TUGAS 6
Program 6
Script Tugas 6
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
//Nama : Raihan Ramadhan
//Nim : 3420210009
//Prodi: Teknik Informatika
void main ()
{
int bil = 3;
int b=0;
do
{
if (bil <30) { printf (" %d +",bil); }
else {printf (" %d = ",bil); }
b = b + bil;
bil = bil + 3;
} while (bil<=30);
cout<<b;
getch();
}
LAMPIRAN TUGAS 7
Program 7
Script Tugas 7
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
//Nama : Raihan Ramadhan
//Nim : 3420210009
//Prodi: Teknik Informatika
void main ()
{
int a,b,c;
for (a=2;a<=10;a+=2)
{
b=2; c=0;
do
{
c = c + b;
if (a == b) {cout<<b<<" = "<<c;} else {cout<<b<<" + ";}
b = b + 2;
}while (b<=a);
cout<<endl;
}
getch();
}
LAMPIRAN TUGAS 8
Program 8
Script Tugas 8
#include <iostream.h>
#include <stdio.h>
#include <conio.h>
//Nama : Raihan Ramadhan
//NIM : 3420210009
//Prodi : Teknik Informatika
void main()
{
int a,b,c;
for (a=1;a<=15;a+=2)
{
b=1;c=1;
do
{
c = c * b;
if (a == b) {cout<<b<<" = "<<c;} else {cout<<b<<" * ";}
b = b + 2;
}while(b<=a);
cout<<endl;
}
getch();
}
Komentar
Posting Komentar