Advertisement
Guest User

asdas

a guest
Oct 24th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(){
  4.  
  5. int j;
  6. int count;
  7. int height;
  8. int number = 0;
  9.  
  10. scanf("%d", &height);
  11.  
  12. number = (height * height) - (height + (height - 1) + (height - 2) * 2 + 1);
  13. printf("\n%d\n", number);
  14.  
  15. for(count = 0; count < height; count++){
  16. int all_symbols = height + (height - 1);
  17. for(j = 0; j < height + (height - 1) ; j++){
  18. int symbols = (count * 2) + 1;
  19. if(count == 0 && j == (height + (height - 2)) / 2){
  20. printf("*");
  21. }else if(count == height - 1){
  22. printf("*");
  23. }else if(j == all_symbols / 2 - symbols / 2 || j == all_symbols / 2 + symbols / 2) {
  24. printf("*");
  25. }else if(j > all_symbols / 2 - symbols / 2 && j < all_symbols / 2 + symbols / 2){
  26. printf("#");
  27. }else{
  28. printf(" ");
  29. }
  30. }
  31. printf("\n");
  32. }
  33.  
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement