Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********************************************************/
- /** 20140409 Classwork_0409 Question 5 Answer Method 2 **/
- /** Maker : Yan **/
- /** E-Mail : [email protected] **/
- /** 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);
- 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((i % 2 == 1 && j % 2 == 0) || (i % 2 == 0 && j % 2 == 1))
- {
- printf("$");
- }
- else
- {
- printf("@");
- }
- }
- }
- printf("\n");
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment