namereq

Untitled

Jun 11th, 2018
1,237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.35 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5.     int i,j,num;
  6.     printf("直角二等辺三角形の底辺の*の数は? >");
  7.     scanf("%d",&num);
  8.     for(i=0;i<num;i++){
  9.         for(j=0;j<num;j++){
  10.             if(i==0){
  11.                 printf("*");
  12.             } else {
  13.                 if(j==i||j==num-1){
  14.                     printf("*");
  15.                 } else {
  16.                     printf(" ");
  17.                 }
  18.             }
  19.         }
  20.         printf("\n");
  21.     }
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment