Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***********************************************/
- /** 20140409 Classwork_0409 Question 4 Answer **/
- /** Maker : Yan **/
- /** E-Mail : [email protected] **/
- /** Date : 2014/04/09 pm.11:00 **/
- /***********************************************/
- #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++)
- {
- for(int k = 1; k <= input + 1; k++)
- {
- if(i == k || j == k || i == input * 2 - (k - 2) || j == input * 2 - (k - 2))
- {
- printf("%3d", input - (k - 2));
- break;
- }
- }
- }
- printf("\n");
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment