answersLogoWhite

0

What is use of printf?

Updated: 8/20/2019
User Avatar

Wiki User

11y ago

Best Answer

printf() is a build-in function under the header file 'stdio.h' in a C Programming language. In c++,the same function is accomplished by 'cout' . It is used to display strings enclosed between double quotes. Its syntax is

printf("...string/sentences/characters....");

After execution,all the characters between the double quotes will be displayed on the output screen.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is use of printf?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Can you use nested printf?

printf ("nested printf returned %d\n", printf ("inner printf\n"));


Can you use printf as a return value?

No, it is a function. But printf does return a value: the number of characters it has written.


How can we write our name in C programming language without using printf?

You can use fputs() instead of printf().


What is the use of printf and scanf function?

Printf prints something to the standard output stream, and scanf inputs something from the standard input stream.


C programming diamond shape for loops Problem and output sample is in the picture?

#include<stdio.h> main() { int i; for(i=1;i<=1;i++) { printf("*",i); } printf("\n"); for(i=1;i<=3;i++) { printf("*",i); } printf("\n"); for(i=1;i<=5;i++) { printf("*",i); } printf("\n"); for(i=1;i<=3;i++) { printf("*",i); } printf("\n"); for(i=1;i<=1;i++) { printf("*",i); } }


What will happen if you do not use break statement?

Everywhere in the code when there is no 'break', the running will continue with the next instruction. Example: for (i=0; i<3; ++i) { printf ("i=%d: ", i); switch (i) { case 2: printf ("two "); case 1: printf ("one "); case 0: printf ("zero "); } printf ("\n"); } The output: 0: zero 1: one zero 2: two one zero


Can you use scanf function within printf function?

Yes: double d; printf ("scanf's just returned %d\n", scanf ("%lf", &d));


Write a program to find the largest of three numbers and print the output in ascending order?

void main() { int a,b,c; clrscr(); printf("Enter the value of a:"); scanf("%d",&a); printf("\nEnter the value of b:"); scanf("%d",&b); printf("\nEnter the value of c:"); scanf("%d",&c); if(a>b) { if(a>c) { if(b>c) { printf("c is smallest\n"); printf("b is middle\n"); printf("a is largest\n"); } else { printf("b is smallest\n"); printf("c is middle\n"); printf("a is largest\n"); } } else { printf("b is smallest\n"); printf("a is middle\n"); printf("c is largest\n"); } } else if(b>c) { if(a>c) { printf("c is smallest\n"); printf("a is middle\n"); printf("b is largest\n"); } else { printf("a is smallest\n"); printf("c is middle\n"); printf("b is largest\n"); } } else { printf("a is smallest\n"); printf("b is middle\n"); printf("c is largest\n"); } getch(); }


What is printf function?

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


How you use multiple programs in switch statement in c language?

program#include#include#includevoid main(){int a,b,ans,ch;clrscr();printf("enter the value of a and b");scanf("%d%d",&a,&b);printf("1.Addition");printf("\n2.Subtraction");printf("\n3.Multiplication");printf("\n4. exit");printf("enter your choice");scanf("%d",&ch);switch(ch){case 1:ans=a+b;printf("\nAfter Addition:%d",ans);break;case 2:ans=a-b;printf("\nAfter Subtraction:%d",ans);break;case 3:ans=a*b;printf("\nAfter Multiplication:%d",ans);break;case 4:exit(0);break;}getch();}


How do you print the message without using printf and semicolon?

use cout << simple


Write a program in c language to print some message on the screen with out using printf?

you can put the printf function inside a if() so that you need not use semicolons. for eg to print my name, if(printf("My Name is Maheedharan")) {} this will work. try this out...