Format specifiers in C

Format Specifiers in C In Hindi

C

Format Specifiers in C In Hindi :- format specifiers kiya hota hai or format specifier for binary in c iska kese use hota hai ham is post me example ke sath format specifier in c in hindi understand karte hai.

Format Specifiers ko ham input and output ke time use karte hai. inke kuch example aap niche dekh sakte hai.

Format Specifiers in C In Hindi

Contents

Some Example :-

Format specifiers list

Format Specifier For Binary in C In Hindi

Binary Format Specifier Se Ham Data Ko Print kara Sakte Hai, Inhe Ham Example Ke Sath Dekhte Hai |

Character format specifier : %c

#include <stdio.h> 
int main() 
{ 
	char ch = 'A'; 
	printf("%c\n", ch); 
	return 0; 
} 

Output :-

A

Integer format specifier : %d, %i

#include <stdio.h> 
int main() 
{ 
	int x = 45, y = 90; 
	printf("%d\n", x); 
	printf("%i\n", x); 
	return 0; 
} 

output :-

45
45

Double format specifier : %f, %e or %E

#include <stdio.h> 
int main() 
{ 
	float a = 12.67; 
	printf("%f\n", a); 
	printf("%e\n", a); 
	return 0; 
} 

output :-

12.670000
1.267000e+01

Unsigned Octal number for integer : %o

#include <stdio.h> 
int main() 
{ 
	int a = 67; 
	printf("%o\n", a); 
	return 0; 
}

Output :-

103

Unsigned Hexadecimal for integer : %x, %X

#include <stdio.h>


int main() 
{ 
	int a = 15; 
	printf("%x\n", a); 
	return 0; 
} 

Output :-

f

String printing : %s

#include <stdio.h> 
int main() 
{ 
	char a[] = "Masterprograming.com"; 
	printf("%s\n", a); 
	return 0; 
} 

Output :-

Masterprograming.com

More formatting

#include <stdio.h> 
int main() 
{ 
	char str[] = "masterprograming.com"; 
	printf("%20s\n", str); 
	printf("%-20s\n", str); 
	printf("%20.5s\n", str); 
	printf("%-20.5s\n", str); 
	return 0; 
}

Output :-

      masterprograming.com
masterprograming.com       
               maste
maste

decimal integer : %d

#include <stdio.h> 
int main() 
{ 
	int a = 0; 
	scanf("%d", &a); // input is 45 
	printf("%d\n", a); 
	return 0; 
} 

output :-

45

Floating data type : %f, %e(double), %lf(long double)

#include <stdio.h> 
int main() 
{ 
	float a = 0.0; 
	scanf("%f", &a); // input is 45.65 
	printf("%f\n", a); 
	return 0; 
}

Output :-

0.000000

String data type in Hindi

#include <stdio.h> 
int main() 
{ 
	char str[20]; 
        printf("Enter Your Name : ");
	scanf("%s", str); // input is masterprograming
	printf("%s\n", str); 
	return 0; 
} 

Output :-

Enter Your Name : masterprograming
masterprograming

Dosto mujhe ummed hai ki aap ‘format specifiers in c with examples ko acchi tarah se samanj gye honge agar aap ko ye post acchi lage to mere is website ko jarur follow kre or ha agar aap video bhi dekhna chahte hai to aap mere channel ko bhi subscribe kar sakte hai. channel ka link aapko home page par mil jayega |

2 thoughts on “Format Specifiers in C In Hindi

Leave a Reply

Your email address will not be published. Required fields are marked *