One C Program to Generate 5 Different Number Patterns

 #include<stdio.h>

int main()

{  int cols=5,rows=5,colno,rowno,sp;


    for (rowno=1;rowno<=rows;rowno++)

      {

        printf("\nRow No %d-  ",rowno);

   // for(colno=1;colno<=cols;colno++) //for 5/5 matirx

      //printf("%d",colno);

      //for(colno=1;colno<=rowno;colno++)//for left upper triangle

        //printf("%d",colno);

       //for(colno=1;colno<=rows+1-rowno;colno++)//for right upper triangle

        //printf("%d",colno);

      // for(sp=0;sp<cols-rowno;sp++)

     //  printf(" ");

         // for(colno=1;colno<=rowno;colno++)//for right lower triangle

        //printf("%d",colno);

           //    for(sp=0;sp<rowno-1;sp++)

       //printf(" ");

          //for(colno=1;colno<=rows+1-rowno;colno++)//for left upper triangle

       // printf("%d",colno);

      }

}

//just remove (/) slashs to run the required program

Comments

Popular posts from this blog

Single Program Using All Automatic String Functions

C program for subtraction of two matrices (2D Arrays)

C program for Multiplication of Two matrices