C program collection
C program to print the number in the formatted form
//string formatting in c program
#include<stdio.h>
int main()
{
char name[]="Radhekrishna";
char name1[]="krishna";
printf("name=%s\n",name);
printf("[%20s]-right alignment\n",name);
printf("[%-20s]-left alignment\n",name);
printf("[%.3s]-only three characters.\n",name1);
printf("[%s]-all characters\n",name1);
return 0;
}
C program to format the string |