Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********************************************************/
- /** 20140409 Classwork_0409 Question 5 Answer Method 1 **/
- /** Maker : Yan **/
- /** E-Mail : ssas1115577@gmail.com **/
- /** Date : 2014/04/09 pm.11:16 **/
- /********************************************************/
- #include <stdio.h>
- #include <stdlib.h>
- void main()
- {
- printf("Enter a number: ");
- int input = 0;
- scanf("%d", &input);
- int check = 0;
- for(int i = 1; i <= input * 2 + 1; i++)
- {
- for(int j = 1; j <= input * 2 + 1; j++)
- {
- if(i == j)
- {
- if(i == input + 1 && j == input + 1)
- {
- printf("*");
- }
- else
- {
- printf("\\");
- }
- }
- else if(i == input + 1 || j == input + 1)
- {
- if(i == input + 1)
- {
- printf("-");
- }
- else
- {
- printf("|");
- }
- }
- else if((input * 2 + 2 - j) == i)
- {
- printf("/");
- }
- else
- {
- if((check % 2) == 1)
- {
- printf("$");
- }
- else if((check % 2) == 0)
- {
- printf("@");
- }
- }
- check++;
- }
- printf("\n");
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement