Tugas Algoritma & Struktur data Pertemuan 6
TUGAS ALGORITMA & STRUKTUR DATA KE 6
Nama : Nasrudin
Nim : 3420210031
Jurusan : Teknik Informatika
TUGAS. 1
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
//Nama : Nasrudin
//Nim : 3420210031
//Prodi : Informatiks
void main ()
{
cout<<"******************"<<endl;
cout<<" nasrudin "<<endl;
cout<<" 3420210031 "<<endl;
cout<<" Tekik Informaika "<<endl;
cout<<"******************"<<endl;
int a;
for (a=1;a<=10;a++)
{
cout<<"Ini Adalah Baris Ke - " <<a<<endl;
}
getch ();
}
TUGAS 2
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
//Nama : Nasrudin
//Nim : 3420210031
//Prodi: Iformaika
void main ()
{
puts ("-----------------------------");
puts (" Program For Bersarang" );
puts ("-----------------------------");
int a,b;
for (a=1;a<=4;a++) {
for (b=2;b<=2;b++) {
printf("Latihan Algoritma \n");
cout<<endl;
}
}
getch();
}
TUGAS 3
#include <stdio.h>
#include <conio.h>
//Nama : Nasrudin
//NIM : 3420210031
//Prodi : Informatika
void main ()
{
int a,b;
for (a=10;a<=55;a++)
{
printf ("\n");
for (b=a;b<=55;b++)
{
printf ("%d",a);
}
}
getch ();
}
TUGAS 4
#include <iostream.h>
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
//Nama : Nasrudin
//Nim : 3420210031
//Prodi: Informatika
void main ()
{
int a,b;
char lagi;
atas:
clrscr();
cout<<"Masukan 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();
}
TUGAS 5
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
//Nama : Nasrudin
//Nim : 3420210031
//Prodi: Teknik Informatika
void main ()
{
int bil = 1;
while (bil<=100)
{
printf (" %d ",bil);
bil++;
}
bil = 2;
cout<<endl;
do
{
printf (" %d ",bil);
bil+=2;
} while (bil <=30);
getch();
}
TUGAS 6
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
//Nama : Nasrudin
//Nim : 3420210031
//Prodi: Informatika
void main ()
{
int bil = 2;
int b=0;
do
{
if (bil <20) { printf (" %d +",bil); }
else {printf (" %d = ",bil); }
b = b + bil;
bil = bil + 2;
} while (bil<=20);
cout<<b;
getch();
}
TUGAS 7
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
//Nama : Nasrudin
//Nim : 3420210031
//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();
}
cukup sekian dan terima kasih
Komentar
Posting Komentar