answersLogoWhite

0

What is printf with examples?

User Avatar

Anonymous

12y ago
Updated: 8/19/2019

print f()

1.function

2.built in

3.user only use

4.out put purpose

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

Can you use nested printf?

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


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); } }


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');


What is the prototype of printf function?

in stdio.h:extern int printf (const char *fmt, ...);


Give examples for pointers within pointers?

If you mean pointers referring pointers then here you are: int main (int argc, char **argv) { printf ("argv (pointer) is %p\n", argv); printf ("*argv (pointer) is %p "%s"\n", *argv, *argv); printf ("**argv (char) is %c\n", **argv); return 0; }


Where the printf statements are stored in memory?

Try this: #include <stdio.h> int main (void) { printf ("printf is at location %p\n", (void *)printf); printf ("main is at location %p\n", (void *)main); return 0; }


How do you write a c program to print words when numbers are given?

void print_num_as_word (unsigned num) { switch (num) { case 0: printf ("zero"); break; case 1: printf ("one"); break; case 2: printf ("two"); break; case 3: printf ("three"); break; case 4: printf ("four"); break; case 5: printf ("five"); break; case 6: printf ("six"); break; case 7: printf ("seven"); break; case 8: printf ("eight"); break; case 9: printf ("nine"); break; } }


What should be given at in if printf hello else world to get the output helloworld that is to make both the statements in ifelse clause to execute what should be given in if clause?

main() { if( !fork() ) printf("Hello"); else printf("World"); } This works fine. if (!printf("hello")) printf("Hello"); else printf(" World\n");


What is main function of printf in a C program?

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);


Write a program in c language to print a diamond?

// // THIS IS A MACH SIMPLER SOLUTION: // void Diamond(int n) { for (int i=0;i<=2*n;i++,printf("\n")) for (int j=0;j<=2*n;j++) (abs(i-n)+abs(j-n)<=n ? printf("*") : printf(" ")); } //============================================= #include<stdio.h> main() { int i,j,k,n,a,b,c,x; printf("enter the # of rows of graphical output"); scanf("%d",&n); /* UPPER HALF OF KITE */ for(i=1;i<=n;i++) { printf("\t"); for (k=1;k<=(n-i);k++) { printf(" "); } for(j=0;j<i;j++) { printf("*"); printf(" "); } for(k=1;k<=(n-i-1);k++) { printf(" "); } printf("\n"); } /* LOWER PART OF KITE */ for(i=(n-1);i>0;i--) { printf("\t"); for (k=(n-i);k>0;k--) { printf(" "); } for(j=i;j>0;j--) { printf("*"); printf(" "); } for(k=(n-i-1);k>0;k--) { printf(" "); } printf("\n"); } getch(); }


How can you print percent d on the screen using printf?

printf("Your text here %d", your_data); or maybe you want to see '%d' as output? Try one of these: printf ("%%d"); printf ("%cd", '%'); printf ("%s", "%d"); fputs ("%d", stdout);