Saturday 28 November 2015

Write C Program to print pattern14

1:  //*****  
2:  // ****   
3:  // ***   
4:  //  **   
5:  //  *  
6:  #include<stdio.h>  
7:  #include<conio.h>  
8:  void main()  
9:  {  
10:   int i, j, k, row;  
11:   clrscr();  
12:   printf("Enter the number of rows you want:\n");  
13:   scanf("%d",&row);  
14:   for(i=row;i>=1;i--)  
15:   {  
16:   for(j=row;j>i;j--)  
17:   {  
18:    printf(" ");  
19:   }  
20:   for(k=1;k<=i;k++)  
21:   {  
22:    printf("*");  
23:   }  
24:   printf("\n");  
25:   }  
26:   getch();  
27:  }  

Write a C Program to print pattern13


1:  //A  
2:  //BA  
3:  //CBA  
4:  //DCBA  
5:  //EDCBA  
6:  #include<stdio.h>  
7:  #include<conio.h>  
8:  void main()  
9:  {  
10:    int i,j,n;  
11:    clrscr();  
12:    printf("Enter the number of rows you want:\n");  
13:    scanf("%d",&n);  
14:    for(i=1;i<=n;i++)  
15:    {  
16:      for(j=i;j>=1;j--)  
17:      {  
18:        printf("%c",'A' + j-1);  
19:      }  
20:      printf("\n");  
21:    }  
22:    getch();  
23:  }  

Write a C Program to print pattern12


1:  //5  
2:  //4 4  
3:  //3 3 3  
4:  //2 2 2 2  
5:  //1 1 1 1 1  
6:  #include<stdio.h>  
7:  #include<conio.h>  
8:  void main()  
9:  {  
10:    int i,j,row;  
11:    clrscr();  
12:    printf("Enter the number of rows you want:\n");  
13:    scanf("%d",&row);  
14:    for(i=row;i>=1;i--)  
15:    {  
16:       for(j=row;j>=i;j--)  
17:       {  
18:         printf("%d ",i);  
19:       }  
20:       printf("\n");  
21:    }  
22:    getch();  
23:  }  

Write a C Program to print pattern11


1:  // Write a to print following pattern  
2:  //*****  
3:  //****  
4:  //***  
5:  //**  
6:  //*  
7:  #include<stdio.h>  
8:  #include<conio.h>  
9:  void main()  
10:  {  
11:   int row,i,j;  
12:   clrscr();  
13:   printf("Enter the number of rows you want: \n");  
14:   scanf("%d",&row);  
15:   for(i=row;i>=1;i--)  
16:   {  
17:   for(j=1;j<=i;j++)  
18:   {  
19:    printf("* ");  
20:   }  
21:   printf("\n");  
22:   }  
23:  getch();  
24:  }  

Write a C Program To print pattern ABCDE descending order

1:  //E  
2:  //DE  
3:  //CDE  
4:  //BCDE  
5:  //ABCDE  
6:  #include <stdio.h>  
7:  #include<conio.h>  
8:  void main()  
9:  {  
10:    int i,j,n;  
11:    clrscr();  
12:    printf("Enter the number of rows you want:\n");  
13:    scanf("%d",&n);  
14:    for(i=n;i>=1;i--)  
15:    {  
16:      for(j=i;j<=n;j++)  
17:      {  
18:        printf("%c",'A' + j-1);  
19:      }  
20:      printf("\n");  
21:    }  
22:    getch();  
23:  }  

Write a Cprogram to print 1,22,333,4444,55555 pattern


1:  //1  
2:  //2 2  
3:  //3 3 3  
4:  //4 4 4 4  
5:  //5 5 5 5 5  
6:  #include<stdio.h>  
7:  #include<conio.h>  
8:  void main()  
9:  {  
10:    int i,j,row;  
11:    clrscr();  
12:    printf("Enter the number of rows you want:\n");  
13:    scanf("%d",&row);  
14:    for(i=1;i<=row;i++)  
15:    {  
16:       for(j=1;j<=i;j++)  
17:       {  
18:         printf("%d ",i);  
19:       }  
20:       printf("\n");  
21:    }  
22:   getch();  
23:  }  

Write a C Program to print Triangle pattern2

1:  //  *  
2:  //  **  
3:  // ***  
4:  // ****  
5:  //*****  
6:  #include<stdio.h>  
7:  #include<conio.h>  
8:  void main()  
9:  {  
10:   int i, j, k, row;  
11:   clrscr();  
12:   printf("Enter the number of rows you want:\n");  
13:   scanf("%d",&row);  
14:   for(i=row;i>=1;i--)  
15:   {  
16:   for(j=1;j<i;j++)  
17:   {  
18:    printf(" ");  
19:   }  
20:   for(k=row;k>=i;k--)  
21:   {  
22:    printf("*");  
23:   }  
24:   printf("\n");  
25:   }  
26:   getch();  
27:  }  

Write a C Program to print Floyds Triangle patten

1:  #include<stdio.h>  
2:  #include<conio.h>  
3:  void main()  
4:  {  
5:   int row,i,j,c=1;  
6:   clrscr();  
7:   printf("Enter the number of rows you want: \n");  
8:   scanf("%d",&row);  
9:   for(i=1;i<=row;i++)  
10:   {  
11:   for(j=1;j<=i;j++)  
12:   {  
13:    printf("%3d ",c);  
14:    c++;  
15:   }  
16:   printf("\n");  
17:   }  
18:   getch();  
19:  }  

Write a C Program to print A,AB,ABC,ABCD,ABCDE pattern

1:  //A  
2:  //AB  
3:  //ABC  
4:  //ABCD  
5:  //ABCDE  
6:  #include<stdio.h>  
7:  #include<conio.h>  
8:  void main()  
9:  {  
10:    int i,j,n;  
11:    clrscr();  
12:    printf("Enter the number of rows you want:\n");  
13:    scanf("%d",&n);  
14:    for(i=1;i<=n;i++)  
15:    {  
16:      for(j=1;j<=i;j++)  
17:      {  
18:        printf("%c",'A' + j-1);  
19:      }  
20:      printf("\n");  
21:    }  
22:    getch();  
23:  }  

Write s C Program to print patter program1

1:  //*  
2:  //**  
3:  //***  
4:  //****  
5:  //*****  
6:  #include<stdio.h>  
7:  #include<conio.h>  
8:  void main()  
9:  {  
10:   int row,i,j;  
11:   clrscr();  
12:   printf("Enter the number of rows you want: \n");  
13:   scanf("%d",&row);  
14:   for(i=1;i<=row;i++)  
15:   {  
16:   for(j=1;j<=i;j++)  
17:   {  
18:    printf("* ");  
19:   }  
20:   printf("\n");  
21:   }  
22:   getch();  
23:  }