Hitung waktu tempuh untuk program di bawah ini. No Program 1

advertisement
Hitung waktu tempuh untuk program di bawah ini.
No
1
2
Program
main(){
println(“No : %d”, 10);
println(“Nama : %s”, “Ali”);
println(“Nilai : %f”, 80.5);
println(“Huruf : %c”, ‘A’);
}
main(){
int no;
char nama[20];
float nilai;
char huruf;
println(“No : ”);
scanf(“%d”, &no);
println(“Nama : “);
scanf(“%s”, &nama);
println(“Nilai : ”);
scanf(“%f”, &nilai);
println(“Huruf : “);
scanf(“%c”, &huruf);
3
4
}
#include<stdio.h>
main(){
float a,b,c;
a=3;
b=4.0;
c=a*a+b*b;
println(“c*c=%d”, c);
}
main(){
println(“No : %d”, 10);
println(“Nama : %s”, “Ali”);
println(“Nilai : ”);
scanf(“%f”, &nilai);
if(nilai>=85 && nilai<=100){
println(“A“);
}else if(nilai<85 && nilai>=70){
println(“B“);
}else if(nilai<70 && nilai>=60){
println(“C“);
}else if(nilai<60 && nilai >=50){
println(“D“);
}else if(nilai<50 && nilai>=0){
println(“E“);
}
5
6
7
8
9
10
}
int a=0, c=0;
scanf(“Masukan Bilangan : %d”, &a);
c=a%2;
if(c==0)
println(“Genap”);
else
println(“Ganjil”);
if n<=0 then{
Read(x)
x=(n+1)+x
write(x)
}else{
for i=1 to n
x=x+n
}
for (bilangan=20 ; bilangan<=100 ; bilangan+=10)
println(“%d”, bilangan);
for(i=0 ; i<=n ; i++){
c=i%2;
if(c==0)
println(“Genap”)
else
println(“Ganjil”)
}
main(){
int i,j;
for(i=0 ; i<5 ; i++) {
for(j=0 ; j<4 ; j++)
printf("i = %i j = %i \r\n", i , j);
}
}
main () {
int a, b, n;
printf(“Masukkan Angka”);
scanf(“%d”, &n);
for(a=1 ; a<=n ; a++) {
for(b=1 ; b<=a ; b++){
if(a==b)
printf(“%d \n”, b);
else
printf(“ “);
}
printf(“\n”);
}
}
Download