• Image 1
  • Image 2
  • Image 3
  • Image 4
  • Image 5
  • Image 6
  • Image 7




Monday, October 22, 2012

PROGRAM LANGUAGE C - CONDITION USING IF


Welcome to my blog.. now in this article, I want giving you tutorial language C using IF.. Previously, you must the program C for making the program. You can copy this coding, and paste in your program or notepad, but if you copy on notepad, you must change save as become “C”.

Example 1 :

#include <conio.h>
#include <stdio.h>

int main()
{
again:
clrscr();
int your_select, countinue, select_again;
printf("============ Welcome Premier Inggris Lovers ============ \n");
printf("    This Is My Sample Program Language C About ISL \n");
printf("                 Only On Or Just On \n");
printf("                  WE ARE KNOWLEDGE \n");
printf("            Lets Choice Your Favorit Team FC \n \n");
printf("        Press Any Number And Enter To Countinue ...");
scanf("%d",&countinue);
clrscr();
printf("Please Your Favorite Football Club : \n");
printf("========== Football Club =========== \n");
printf("1. Persija Football Club \n");
printf("2. Persib Football Club \n");
printf("3. Sriwijaya Football Club \n");
printf("4. Arema Football Club \n");
printf("5. Persipura Football Club \n");
printf("6. Persela Football Club \n \n \n");
printf("Masukan Pilihan Menu Anda : ");
scanf("%d",&your_select);
if (your_select == 1)
{
printf("\n You Are Choice PERSIJA \n");
}
else if (your_select == 2)
{
printf("\n You Are Choice PERSIB \n");
}
else if (your_select == 3)
{
printf("\n You Are Choice SRIWIJAYA \n");
}
else if (your_select == 4)
{
printf("\n You Are Choice AREMA \n");
}
else if (your_select == 5)
{
printf("\n You Are Choice PERSIPURA \n");
}
else if (your_select == 6)
{
printf("\n You Are Choice PERSELA \n");
}                  
else
{
printf("\n Oh no... you are wrong !!! \n \n \n");
}
printf("You Will Choice Your Favorit FC Again ?? [Y = 1/ N = 0] : ");
scanf("%d",&select_again);
if (select_again == 1)
{
goto again;
}
else
{
printf("Thanks You");
}
getch ();
return 0;
}


Logic :

Clrscr >> for cleaning the output window.

Conio.h and stdio.h >> for calling on folder it.

Printf >> for printing in output window

Scanf >> for input on output window.

Getch and retutn >> for return the value and ending the program.

If >> is conditional, to be found : iF, IF then else, if else if else.



Ok..just it..
I hopr you understand…
See you later

No comments:

Post a Comment