\* C program for showing format specifiers in c *\
PROGRAM:
#include<stdio.h>
main()
{
printf("\n This is a integer Number1: %d",123);
printf("\n This is a integer Number2: %06d",25);
//convert it to 6 digit number
printf("\n This is a integer Number3: %i",123);
printf("\n This is a Float value: %f",3.14);
printf("\n This is a Hexa Decimal value: %X",150);
printf("\n This is a Octal Value: %o",150);
printf("\n This is unsigned value: %u",150);
printf("\n This is a character: %c",'A');
printf("\n This is a string: %s","Cprogramsblog");
printf("\n Just print : %%");
printf("\n Just print \" \" symbol: \" \" ");
}
Output: ( using GNU GCC Compiler with Code Blocks IDE )
This is a integer Number1: 123
This is a integer Number2: 000025
This is a integer Number3: 123
This is a Float value: 3.140000
This is a Hexa Decimal value: 96
This is a Octal Value: 226
This is unsigned value: 150
This is a character: A
This is a string: Cprogramsblog
Just print : %
Just print " " symbol: ""
PROGRAM:
#include<stdio.h>
main()
{
printf("\n This is a integer Number1: %d",123);
printf("\n This is a integer Number2: %06d",25);
//convert it to 6 digit number
printf("\n This is a integer Number3: %i",123);
printf("\n This is a Float value: %f",3.14);
printf("\n This is a Hexa Decimal value: %X",150);
printf("\n This is a Octal Value: %o",150);
printf("\n This is unsigned value: %u",150);
printf("\n This is a character: %c",'A');
printf("\n This is a string: %s","Cprogramsblog");
printf("\n Just print : %%");
printf("\n Just print \" \" symbol: \" \" ");
}
Output: ( using GNU GCC Compiler with Code Blocks IDE )
This is a integer Number1: 123
This is a integer Number2: 000025
This is a integer Number3: 123
This is a Float value: 3.140000
This is a Hexa Decimal value: 96
This is a Octal Value: 226
This is unsigned value: 150
This is a character: A
This is a string: Cprogramsblog
Just print : %
Just print " " symbol: ""
nice article.thank you.
ReplyDeleteweb programming tutorial
welookups