How to Make a Big Cross Using C


Cross sign,….. Okay let’s try to make this one,..

#include <stdio.h>

#include <stdlib.h>

int main()

{

int i,j,n,k;

printf(“input your number, it must be odd : “);scanf(“%d/n”,&n);

k=(n/2)+1;

for (i=1;i<=n;i++)

{

for (j=1;j<=n;j++)

{

if ((i==j)or((i+j)==(n+1)))

{

printf(“*”);

}

else

{

printf(” “);

}

}

printf(“\n”);

}

system(“pause”);

return 0;

}

May be your algorithm different with mine, but it’s not a problem. It’s Okay since it has the same result.

Iklan
By Yusfia Hafid Aristyagama Posted in Coding Dengan kaitkata , ,

Tinggalkan Komentar

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google+

You are commenting using your Google+ account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s