patterns programs in c

/******************************************************************************

                            Online C Compiler.
                Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <stdio.h>

int main()
{
    int i,j,k,l;
    for(i=1;i<=9;i++){
     
        for(j=1;j<=5;j++){
         
           if(i<6){if(j<6-i) printf("  ");
            else printf("* ");
        }
        else{
            if(j<=i-5) printf("  ");
            else printf("* ");
        }
     
        }
        printf("\n");
     
    }

    return 0;
}






/******************************************************************************

                            Online C Compiler.
                Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <stdio.h>

int main()
{
    int i,j,k,l;
    for(i=1;i<=9;i++){
        
        for(j=1;j<=5;j++){
           
           if(i<6){if(j<6-i) printf(" ");
            else printf("* ");
        }
        else{
            if(j<=i-5) printf(" ");
            else printf("* ");
        }
       
        }
        printf("\n");
        
    }

    return 0;
}







/******************************************************************************

                            Online C Compiler.
                Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/





#include <stdio.h>

int main()
{
    int i,j,k,l;
    for(i=1;i<=7;i++){
        k=65;
        for(j=1;j<=14;j++){
           
           if(j<8){
               if(j<i) printf(" ");
                   else printf("%c",k++);
               
           }
           else{
               if(j<=15-i) printf("%c",--k); 
                   else printf(" ");
           }
        
       
        }
        printf("\n");
        
    }

    return 0;
}




/******************************************************************************

                            Online C Compiler.
                Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <stdio.h>

int main()
{
    int i,j,k,l;
    for(i=65;i<68;i++){
     
        for(j=65;j<68;j++){
       
     
         for(k=65;k<68;k++){
         printf("%c%c%c ",i,j,k);
     
     
        }
        }
        printf("\n");
     
    }

    return 0;
}




/******************************************************************************

                            Online C Compiler.
                Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/



#include <stdio.h>

int main()
{
    int i,j,k,l;
    for(i=65;i<71;i++){
     
        for(j=65;j<i;j++){
       
        if(i%2==0){
            if(j%2==0) printf("0");
            else printf("1");
        }
        else
        {
             if(j%2==0) printf("1");
            else printf("0");
        }
     
        }
        printf("\n");
     
    }

    return 0;
}




/******************************************************************************

                            Online C Compiler.
                Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/



#include <stdio.h>

int main()
{
    int i,j,k,l;
    for(i=65;i<71;i++){
     
        for(j=65;j<i;j++){
       
            if(j%2==0) printf("0");
            else printf("1");
     
        }
        printf("\n");
     
    }

    return 0;
}






/******************************************************************************

                            Online C Compiler.
                Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/



#include <stdio.h>

int main()
{
    int i,j,k,l;
    for(i=1;i<=4;i++){
        k=5-i;
        for(j=1;j<=8;j++){
       
       if(j<5){
           if(j<6-i) printf("%d",j);
           else printf("*");
       }
       else{
         if(j<4+i) printf("*");
           else printf("%d",k--);
       }
     
     
        }
        printf("\n");
     
     
    }

    return 0;
}



/******************************************************************************

                            Online C Compiler.
                Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/


#include <stdio.h>

int main()
{
    int i,j,k,l,index=5;
    for(i=1;i<=5;i++,index--){
       
        for(j=1,k=5;j<=5;j++,k--){
         
            if(j==index){
                printf("*");
             
            }
       
           
        if(j!=index) printf("%d",k);
       
         
   
        }
       
       
        printf("\n");
       
       
    }

    return 0;
}




Comments

Popular posts from this blog

aaabb to32 ,aabbb to a2b3 convert in c-asr

a2b3 output aabbb c program and beautiful use of getchar() ,isdigit() ,atoi() functions and stdlib.h header file-asr

C program to print square spiral number pattern - asr