Nested If-Else

# include <iostream.h>
# include <conio.h>

main ()
{

int bil;

clrscr();

cout <<"Masukkan bilangan ! [1-100]: ";
cin >>bil;

if(bil<50)
{
if(bil%2) //Jika bil habis dibagi 2, maka
{
cout <<"Bilangan < 50";
cout <<"Bilangan GENAP";
}
else //Jika bil tidak habis dibagi 2, maka
{
cout <<"Bilangan < 50";
cout <<"Bilangan GANJIL";
}
}

else
{
if(bil%2)
{
cout <<"Bilangan >= 50";
cout <<"Bilangan GENAP";
}
else
{
cout <<"Bilangan >= 50";
cout <<"Bilangan GANJIL";
}
}


getch();
}

Posted in . Bookmark the permalink. RSS feed for this post.

Leave a Reply

Search

Support by Blogger ITN | Converted by LiteThemes.com