Holey_yan

20140409_KUAS_VisualC++_Classwork_0409_Question_1_Answer

Apr 12th, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. /***********************************************/
  2. /** 20140409 Classwork_0409 Question 1 Answer **/
  3. /** Maker  : Yan                              **/
  4. /** E-Mail : [email protected]            **/
  5. /** Date   : 2014/04/09 pm.10:27              **/
  6. /***********************************************/
  7.  
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10.  
  11. void main()
  12. {
  13.     printf("Enter a number: ");
  14.     int input = 0;
  15.     scanf("%d", &input);
  16.  
  17.     for(int i = 1; i <= input; i++)
  18.     {
  19.         for(int j = 1; j <= input; j++)
  20.         {
  21.             if(i == 1 || j ==1 || i == input || j == input)
  22.             {
  23.                 printf("*");
  24.             }
  25.             else if(i == j)
  26.             {
  27.                 printf("*");
  28.             }
  29.             else
  30.             {
  31.                 printf("?");
  32.             }
  33.         }
  34.         printf("\n");
  35.     }
  36.     system("pause");
  37. }
Advertisement
Add Comment
Please, Sign In to add comment