Welcome to our BMR AI CHATBOT.
A free expermental AI tool where you can interact with the webpage, ask question about the webpage and other related doubts.
In some cases reponses may take time to get. In case of error give us your report.
You responses are stored for experimental purpuses. And your personal info is not integrated with you in any way.
Note: AI can make mistakes and can give in appropiate responses. Your feedbak will help us improve.
Stay tuned for more AI products and tools
And Finally don't forget to give your feedback. click on the icon provided to give feedback.
Used with functions like printf and scanf.
They define how data is presented or interpreted during input and output operations.
They basically starts with a %
Format Specifier
Description
Example
%c
Character
printf("%c", 'A');
%s
String
printf("%s", "Hello");
%d
Decimal integer
printf("%d", 42);
%ld
Long decimal integer
printf("%ld", 1000000L);
%f
Floating-point number (default precision)
printf("%f", 3.14)
%lf
Double floating-point number
printf("%lf", 3.14);
%e, %E
Scientific notation (exponential format)
printf("%e", 3000.0);
%u
Unsigned decimal integer
printf("%u", 42);
%x, %X
Hexadecimal integer
printf("%x", 255);
%o
Octal integer
printf("%o", 64);
%p
Pointer address
printf("%p", &variable);
%n
Number of characters written so far
printf("Hello%n", &count);
%%%
Literal % character
printf("100%%");
#include <stdio.h>
int main() {
char ch;
printf("Enter a character: ");
scanf("%c", &ch);
printf("You entered: %c\n", ch);
char str[20];
printf("Enter a string: ");
scanf("%s", str);
printf("You entered: %s\n", str);
int num;
printf("Enter an integer: ");
scanf("%d", &num);
printf("You entered: %d\n", num);
float floatNum;
printf("Enter a floating-point number: ");
scanf("%f", &floatNum);
printf("You entered: %f\n", floatNum);
double doubleNum;
printf("Enter a double floating-point number: ");
scanf("%lf", &doubleNum);
printf("You entered: %lf\n", doubleNum);
double scientificNum = 3000.0;
printf("Scientific Notation: %e\n", scientificNum);
unsigned int unsignedNum = 42;
printf("Unsigned Decimal Integer: %u\n", unsignedNum);
int hexNum = 255;
printf("Hexadecimal Integer: %x\n", hexNum);
int octalNum = 64;
printf("Octal Integer: %o\n", octalNum);
int variable = 42;
printf("Pointer Address: %p\n", &variable);
int count;
printf("Hello%n", &count);
printf("Number of Characters Written So Far: %d\n", count);
printf("Literal Percent Sign: %%\n");
return 0;
}
The Concepts and codes you leart practice in Compilers till you are confident of doing on your own. A Various methods of examples, concepts, codes availble in our websites. Don't know where to start Down some code examples are given for this page topic use the code and compiler.