View Code of Problem 53

#include <stdio.h>
#include <math.h>
#include <string.h>
int main(){
  int i,j,k,f=0,a,min=0,max=0,q[10][10],temp,sum=0;
  char s[80];
   scanf("%d",&a);
   for(i=1;i<=a;i++){
      k=a-i;
	  if(k!=0){
		for(j=0;j<k;j++){
	     printf("%c",' ');
		 }
	  }
	  for(j=0;j<i*2-1;j++){
	     printf("%c",'*');
	  }
	  printf("\n");
   }
   for(i=a-1;i>=1;i--){
      k=a-i;
	  if(k!=0){
		for(j=0;j<k;j++){
	     printf("%c",' ');
		 }
	  }
	  for(j=0;j<i*2-1;j++){
	     printf("%c",'*');
	  }
	  printf("\n");
   }
  return 0;
 }
	

Double click to view unformatted code.


Back to problem 53