-->
Showing posts with label left and right formatting in c. Show all posts
Showing posts with label left and right formatting in c. Show all posts

Wednesday, June 25, 2025

Table Formatting in C Programming with right and left alignment | Format Specifier Examples with Code

 


C program collection


C program to print the number in the formatted form

//table formatting program in c

#include<stdio.h>

int main()

{

//header part

printf("| %-10s | %-13s | %-11s\n","name","age","address");

printf("| %-12s | %-12d | %-12s\n","Ram",22,"ktm");

printf("| %-12s | %-12d | %-12s\n","sam",24,"pkh");

printf("| %-12s | %-12d | %-12s\n","Raj",27,"bkh");

return 0;

}

output:-

C program to format table