Computer for SEE and NEB

It is a complete SEE and NEB solution for computer science. It includes Computer Fundamentals, Database (SQL), Programming in C QBASIC, CSS, JavaScript, and PHP for beginners.

Breaking

Post Top Ad

Your Ad Spot

Wednesday, September 21, 2022

String Pattern in C programming

String Pattern in C programming

 

 

 





#include<stdio.h>

#include<conio.h>

main()

{

int x,y;

char name[]="COMPUTER";

for(x=0;x<8;x++)

{

for(y=x;y<8;y++)

{

printf("%c",name[y]);

}

printf("\n");

}

getch();

}

 

 







#include<stdio.h>

#include<conio.h>

main()

{

int x,y;

char name[]="COMPUTER";

for(x=0;x<8;x++)

{

for(y=0;y<=x;y++)

{

printf("%c",name[y]);

}

printf("\n");

}

getch();

}

 

 

 

 







#include<stdio.h>

#include<conio.h>

 main()

{

int x,y;

 

char name[]="COMPUTER";

for(x=0;x<8;x++)

{

for(y=0;y<=x;y++)

{

printf("%c",name[x]);

}

printf("\n");

}

getch();

}

 

 






#include<stdio.h>

#include<conio.h>

main()

{

int x,y;

char name[]="COMPUTER";

for(x=0;x<8;x++)

{

for(y=x;y<8;y++)

{

printf("%c",name[x]);

}

printf("\n");

}

getch();

}

 

 

 

 

 

 




#include <stdio.h>

int main()

{

   int i, j;

  

   for (i = 1; i <= 5; ++i)

   {

      for (j = 1; j <= i; ++j)

         {

         printf("*");

      }

      printf("\n");

   }

   return 0;

}

 

 

 







#include <stdio.h>

int main()

{

   int i, j;

  

   for (i = 5; i >=1; --i)

   {

      for (j = 1; j <= i; ++j)

         {

         printf("*");

      }

      printf("\n");

   }

   return 0;

}

 

 

 








#include <stdio.h> 

#include <conio.h> 

main() 

     

    int i, j, rows, k = 0; 

    printf (" Enter how many rows: \n"); 

    scanf ("%d", &rows);  

     

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

    { 

        for ( j = 1; j <= rows - i; j++) 

        { 

            printf ("  ");  

        } 

      

        for ( k = 1; k <= ( 2 * i - 1); k++) 

        { 

            printf ("* "); 

        } 

        printf ("\n"); 

    } 

   

 

 










#include <stdio.h> 

#include <conio.h> 

main() 

    

    int i, j, rows, k, m = 1; 

    printf (" Enter how many rows: \n"); 

    scanf ("%d", &rows);  

    printf("\n"); 

     

    for ( i = rows; i >= 1; i--) 

    { 

         

        for ( j = 1; j <= m; j++) 

        { 

            printf ("  "); 

        } 

     

        for ( k = 1; k <= ( 2 * i - 1); k++) 

        { 

            printf ("* ");  

        } 

        m++; 

        printf ("\n"); 

    } 

    getch(); 

}


No comments:

Post a Comment

Post Top Ad

Your Ad Spot

Pages