Pertemuan 7 Algoritma dan Struktur data
Assalamualaikum wr.wb
Nama: Raihan Fajarahmatan
NIM: 3420210010
Prodi: Teknik Informatika
Tugas 7.1
void main ()
{
int i;
int a = 2;
int b = 4;
cout<<"------------------------------------------\n";
cout<<" No A B A*A B*B\n";
cout<<"------------------------------------------\n";
for (i=1; i<=10; i++)
{
gotoxy(2,3+i);cout<<i;
gotoxy(6,3+i);cout<<a;
gotoxy(12,3+i);cout<<b;
gotoxy(17,3+i);cout<<a*a;
gotoxy(22,3+i);cout<<b*b;
a=a+2;
b=b+3;
cout<<"\n";
}
cout<<"------------------------------------------\n";
getch();
}
Tugas 7.2
#include <stdio.h>
#include <iostream.h>
#include <conio.h>
//Nama : Raihan Fajarahmatan
//NIM : 3420210010
//Prodi : Teknik Informatika
void judul(){
puts("=========================================");
puts("\tContoh Array Dimensi 1");
puts("=========================================");
}
void main()
{
judul();
int i;
float harga [7];
harga[0]=2000;
harga[1]=4000;
harga[2]=6000;
harga[3]=8000;
harga[4]=10000;
harga[5]=12000;
harga[6]=14000;
harga[7]=16000;
printf("Variable harga 1 adalah %.0f\n",harga[1]);
printf("Variable harga 5 adalah %.0f\n",harga[5]);
for(i=1;i<=3;i++)
{
cout<<endl;
}
puts("Nilai dari Seluruh Variabel adalah:");
for(i=0;i<5;i++)
{
printf("variabel harga %d adalah %.0f\n",i,harga[i]);
}
getch();
}
Tugas 7.3
Sekian dan Terimakasih
Wassalamualaikum wr.wb
Komentar
Posting Komentar