answersLogoWhite

0

The syntax for printf is:

int printf(const char *format, ...);

Simple usage examples:

1. Print character literal: printf("%c", 'a');

2. Print character variable: printf("%c", my_char);

3. Print string literal: printf("%s", "hello world");

4. Print string variable: printf("%s", my_string);

5. Print integer variable: printf("%d", my_integer);

6. Print floating-point variable: printf("%f", my_float);

User Avatar

Wiki User

13y ago

What else can I help you with?

Continue Learning about Engineering

What must every c program have?

A main function must be present in every C program.


Is printf keyword?

== == What is printf in c or prototype of printf with example (q) What is prototype of printf function ? Explain each term. Ans: Prototype of printf function is : int printf( const char *format ,…) Explanation of each term : Parameter of printf function is : (three continuous dots) : It is called ellipsis. It indicates the variable number of arguments. Example of ellipsis: #include void ellipsis(int a,...); void main() { int a=5,b=10; clrscr(); ellipsis(a,b); getch(); } void ellipsis(int a,...) { printf("%d ",a); } Output:5 So printf function can have any number of variables as an argument.


What is the only function all C plus plus programs must contain?

Every C plus plus program that is a main program must have the function 'main'.


Write a program to display Identity matrix?

#include <stdio.h> void main() { int a,b,c,i,j; printf("Enter the number of rows for square matrix : "); scanf("%d",&a); for(i=1;i<=a;i++) { for(c=1,j=1;j<=a;j++,c++) { if(c==i) printf("1 "); else printf("0 "); } printf("\n"); } getch(); }


C program to find the largest and smallest of three numbers using IF IF ELSE?

#include<stdio.h> #include<conio.h> void main() { int a,b,c; clrscr(); printf("Enter any three numbers"); scanf("%d%d%d",&a,&b,&c); if(a>b&&a>c) printf("A is greatest"); else if(b>a&&a>c) printf("B is greatest"); else if(c>a&&c>b) printf("C is greatest"); if(a<b&&a<c) printf("A is smallest"); else if(b<a&&b<c) printf("B is smallest"); else if(c<a&&c<b) printf("C is smallest"); getch(); }

Related Questions

How you write a c program for making a call in gcc?

int main() { // Call the printf function printf("This is a function call!\n"); return 0; }


How do you write a programme in c?

Basic Program in "C" #include <stdio.h> /*This is the standard input/output library function*/ main(void) /*All C programs must have the function main*/ { char ch; printf("This is a C Program."); /* Every line of code in C must end with a semi colon*/ printf("Welcome to C!");/*the printf outputs the line of text to the screen*/ scanf("%c%c", &ch, &ch); /* This is a trick way to pause the computer so you can read the information on the screen*/ return 0; /* Indicates that your program has terminated successfully*/


Write a c program to have followiing as output?

void main() { printf("followiing"); }


Give an example of computer program?

A C program #include <stdio.h> int main() { printf("Hello, world!"); }


How do you display semi colon without using semi colon in a c program?

main() { if(printf("%c",59)) }


What must every c program have?

A main function must be present in every C program.


How can a person write a program without using printf function in C language?

Here is an example:#include int main (void){puts ("Hello, world");return 0;}


Exchange to interchange in two var in c program?

#include#includevoid main(){ int a,b,c;printf("\nEnter 1st no.");scanf("%d",&a);printf("\nEnter 2nd no.");scanf("%d",&b);c=a;a=b;b=c;printf("\n1st no.",a);printf("\n2nd no.",b);getch();}


How do you write a c program without using main function?

You cannot create a program with the extension .exe without the function main. You can create a dll which does not even use main. WinApi uses another main function but it's still a main function. Main function is entry point for your program, no entry point no program.Write a progrmme in c with out using a main function. #include #define decode(s,t,u,m,p,e,d)m##s##u##t #define begin decode(a,n,i,m,a,t,e) int begin() { printf("HELLO") }


What is main function used in c?

if you do not used main function in c program when errors are accrued


What is printf function?

Printf function is used in c language. Printf is used to print something to the standard output. ex: printf ('welcome');


Is printf keyword?

== == What is printf in c or prototype of printf with example (q) What is prototype of printf function ? Explain each term. Ans: Prototype of printf function is : int printf( const char *format ,…) Explanation of each term : Parameter of printf function is : (three continuous dots) : It is called ellipsis. It indicates the variable number of arguments. Example of ellipsis: #include void ellipsis(int a,...); void main() { int a=5,b=10; clrscr(); ellipsis(a,b); getch(); } void ellipsis(int a,...) { printf("%d ",a); } Output:5 So printf function can have any number of variables as an argument.

Trending Questions
Why do engines with less cylinders rev higher then ones with more cylidners 2 or 4 cylinders opposed to 8? What are 2 simple characteristics of simple technology? How do you open a svd file saved on a disc? What element is used in manufacturing of lightweight aircraft frames? What the different between PVC and SVC? How do you set automatic duplex printing on a hp laser jet 9100 from a perl application? What would happen if a hydraulic system had a leak and lost some of its fluid? How many hours can a railroad engineer work? Can a low pass filter be used as an integrator? Why do you need Pollution liability insurance? Is Jasmine V left handed or right handed? Why is it important to replace an old and frayed cable of an appliance that has a damaged insulation? You are a 4 digit number your thousands digit is twice your ones digit your hundreds digit is four times your thousands digit and your tens digit is the sum of your ones and thousands digit what numbe? How do you create a paragraph using style based on is Normal style for following paragraph is Normal Font properties are Arial 14 pt Bold and font color red accent 2 darker 50 percent? What invention was most needed in 1900s to help run offices and factories? Why emitter base junction is always forward biased for normal operation of transistor? What is the breakdown voltage of the silicon controlled rectifier? Do right hand shafts shift gears in the same direction? What does it mean when something is resistant to tearing? Is 0.88 c reactive protein level to high?