Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program to print string in different pattern

Posted By: Abelardo Fischer     Category: C Programming     Views: 9687

Write a program to print string in different pattern i.e using %12.5s in printf function.

Code for Program to print string in different pattern in C Programming

#include<string.h>
#include<stdio.h>
#include<conio.h>

void main()
{
    staticchar country[15] = "United Kingdom";
    clrscr();
    printf("\n\n");
    printf("_________________\n");
    printf("|%15s|\n",country);
    printf("|%5s|\n",country);
    printf("|%15.6s|\n",country);
    printf("|%-15.6s|\n",country);
    printf("|%15.0s|\n",country);
    printf("|%.3s|\n",country);
    printf("|%s|",country);
    printf("\n-----------------\n");
    getch();
}
  
Share: 


Didn't find what you were looking for? Find more on Program to print string in different pattern Or get search suggestion and latest updates.

Abelardo Fischer
Abelardo Fischer author of Program to print string in different pattern is from Frankfurt, Germany.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!