answersLogoWhite

0

Wikipedia offers a great article about printf. They even provide samples of coding that is used in programs. If further assistance is needed try the website C Plus Plus.

User Avatar

Wiki User

12y ago

What else can I help you with?

Continue Learning about Engineering

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


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


What is printf in c plus plus programming?

printf is a function that prints formatted text to the standard output stream (stdout). To make use of it in C++, you must include cstdio or any file that includes cstdio. For more information, see related links.


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


How do you write a C program to print your name one hundred times?

Duhh.. printf("hello "); printf("hello "); printf("hello "); printf("hello "); printf("hello "); printf("hello "); printf("hello "); printf("hello "); printf("hello "); Just kidding. Just loop the printing. int x = 0; for(x = 0; x<11; x++) { printf("hello "); } and if you want each "hello" to be in a new line, use this: printf("hello\n");

Related Questions

How do you write a c program to input a number from 0-9 and display the number in words using if else statement?

void print_number (int n) {if (n==0) printf ("zero"); else if (n==1) printf ("one"); else if (n==2) printf ("two"); else if (n==3) printf ("three"); else if (n==4) printf ("four"); else if (n==5) printf ("five"); else if (n==6) printf ("six"); else if (n==7) printf ("seven"); else if (n==8) printf ("eight"); else if (n==9) printf ("nine"); } Nobody writes code like this. it is highly inefficient because the larger the value the more comparisons we need to perform. An experienced programmer will see that this function is nothing more than a thinly-veiled switch that can be expressed more efficiently as follows: void print_number (int n) { switch (n) { 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"); } } A more efficient method is to place the words in a zero-based array and use the value as an index into that array.


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


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


What is the function and syntax of printf statement?

it's not a statement, it's a function: len= printf (format, ...more-parameters...);


What is printf in c plus plus programming?

printf is a function that prints formatted text to the standard output stream (stdout). To make use of it in C++, you must include cstdio or any file that includes cstdio. For more information, see related links.


Can you use nested printf?

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


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


How can one learn more about Fernande's Guitars?

There are many places where one could learn more about Fernande's Guitars. One of the best places to learn more about these guitars would be to check out Wikipedia.


How can one learn more about the Sunrise Radio Broadcasting company?

One can learn more about the Sunrise Radio Broadcasting company from their Wikipedia entry. One can also learn more about them directly from their own website.


Where can one learn more about fluid handling?

There are many places where one can learn more about fluid handling. One can learn more about fluid handling at popular on the web sources such as Carbis Fluid Handling.


Where can one learn more about the Blackberry exchange?

One can learn more about the Blackberry Exchange on many websites online. Blackberry's website allows one to learn this information and how it works.


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