Belajar Pemrograman Dasar dengan Bahasa C Part 3

Posted on Updated on


Menggunakan perintah Kontrol If – Else

Perintah If Else Bersarang

/* Komentar Kelulusan */
#include<stdio.h>
main ()
{
 int na;
 printf ("Masukkan Nilai angka = ');
 scanf ("%i", &na);
 if (na >=85)
 printf ("Nilai anda A. Anda layak dapat bintang\n");
 else if (na>=70 && na<=84)
 printf ("Nilai anda B. Good.......good......good\n");
 else if (na>=55 && na<=69)
 printf ("Nilai anda C. Lumayan deh\n");
 else if (na>=30 && na<=54)
 printf ('Nilai anda D. Don't worry, next time better\n");
 else if (na<=29)
 printf ("Nilai anda E. Anda tidak LULUS\n");
 else printf ("Nilai anda tidak dikenal");
}

 


		

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s