Looping (pengulangan), untuk output seperti :
"Happy New Year 2012"
"Happy New Year 2012"
"Happy New Year 2012"
"Happy New Year 2012"
"Happy New Year 2012"
Syntax menggunakan WHILE:
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int d=1,j;
while (d<=5)
{
j=1;
while (j<=1)
{
printf ("Happy New Year 2012");
j=j+1;
}
printf("\n");
d=d+1;
}
getche();
}
Syntax menggunakan DO-WHILE
#include<stdio.h>
#include<conio.h>
void main()
{
int d=1;
clrscr();
do
{
printf("\n Happy New Year 2012");
d++;
}
while (d<=5);
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int d;
for(d=1;d<=5;d++)
{
printf("\n Happy New Year 2012");
}
getch();
}
Selamat belajar... (^_^)
Tidak ada komentar:
Posting Komentar