Contoh Program Bintang

March 30, 2012 at 5:10 pm Leave a comment

sebuah segitiga sama kaki dengan bentuk seperti di bawah ini. Dengan masukan N dari
user.


#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int main(void){
 int max=5,x,y;
 for (x=0;x<max;x++){
 for (y=0;y<=x;y++){
 if(x%2==0){
 printf("* ");
 }
 }
 printf("\n");
 }
 for (x=max;x>0;x--){

 for (y=x-1;y>0;y--){
 if(x%2==0){
 printf("* ");
 }
 }
 printf("\n");
 }

system("pause");
 return 0;
}

Entry filed under: Algoritma & Struktur Data. Tags: .

Operator Pada C++ Pointer di C++

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

Trackback this post  |  Subscribe to the comments via RSS Feed


JAM

Admin

Categories

Recent Posts

DATE

Blog Stats

  • 3,258 hits

%d bloggers like this: