1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

print the letter "S"

Discussion in 'C' started by narendrav, Jun 12, 2011.

  1. narendrav

    narendrav New Member

    Joined:
    Jun 12, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    hi.
    i need to print the letter "S"
    in the following format.
    it should have 15 rows and 18 columns.
    i have to do it using "for.." and "if.." statements
    Code:
    ****************
    **------------**
    ******--------**
    ****
    ****
    ****
    ****--------****
    -----------*****
    -----------*****
                ****
                ****
                ****
    ****--------****
    ***----------***
    **-----------***
    
     
  2. kupparamakrishna

    kupparamakrishna New Member

    Joined:
    Jun 23, 2011
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    student
    Location:
    banglore
    Try this code hope it works...
    Code:
    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    int a[15][3],i,j;
    clrscr();
    for (i=0;i<3;i++)
    {
    for(j=0;j<16;j++)
    {
    printf("%d",a[i][j]=0);
    }
    printf("\n");
    }
    for(i=0;i<3;i++)
    {
    for(j=0;j<4;j++)
    {
    printf("%d",a[i][j]=0);
    }
    printf("\n");
    }
    for(i=0;i<3;i++)
    {
    for(j=0;j<16;j++)
    {
    printf("%d",a[i][j]=0);
    }
    printf("\n");
    }
    printf("            ");
    for(i=0;i<3;i++)
    {
    for(j=15;j>11;j--)
    {
    printf("%d",a[i][j]=0);
    }
    printf("\n");
    printf("            ");
    }
    printf("\r");
    for(i=0;i<3;i++)
    {
    for(j=0;j<16;j++)
    {
    printf("%d",a[i][j]=0);
    }
    printf("\n");
    }
    }
     
  3. kupparamakrishna

    kupparamakrishna New Member

    Joined:
    Jun 23, 2011
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    student
    Location:
    banglore
    i have done this using zeros so ur 's' will be with zeros
     
  4. kupparamakrishna

    kupparamakrishna New Member

    Joined:
    Jun 23, 2011
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    student
    Location:
    banglore
    try this code
    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    int a[15][3],i,j;
    clrscr();
    for (i=0;i<3;i++)
    {
    for(j=0;j<16;j++)
    {
    printf("%d",a[j]=0);
    }
    printf("\n");
    }
    for(i=0;i<3;i++)
    {
    for(j=0;j<4;j++)
    {
    printf("%d",a[j]=0);
    }
    printf("\n");
    }
    for(i=0;i<3;i++)
    {
    for(j=0;j<16;j++)
    {
    printf("%d",a[j]=0);
    }
    printf("\n");
    }
    printf(" ");
    for(i=0;i<3;i++)
    {
    for(j=15;j>11;j--)
    {
    printf("%d",a[j]=0);
    }
    printf("\n");
    printf(" ");
    }
    printf("\r");
    for(i=0;i<3;i++)
    {
    for(j=0;j<16;j++)
    {
    printf("%d",a[j]=0);
    }
    printf("\n");
    }
    }
     

Share This Page