Friday, September 2, 2016

// // Leave a Comment

Printing Values With Printf

Question: (Printing Values with printf) Write a program that prints the numbers 1 to 4 on the same line. Write the program using the following methods.
  1. Using one printf statement with no conversion specifiers.
  2. Using one printf statement with four conversion specifiers.
  3. Using four printf statements.
 * Website:
 * Program that prints the numbers 1 to 4 on the same line using three
 * different methods.

#include <stdio.h>
int main ( ){
    printf("1 2 3 4\n");
    printf("%d %d %d %d\n", 1, 2, 3, 4);
    printf("1 ");
    printf("2 ");
    printf("3 ");
    return 0;
Printing values with printf program output
Program output
Click here to see other solutions to Deitel C How To Program exercises.


Post a Comment

DISCLAIMER: Opinions expressed in comments are those of the comment writers alone and does not reflect or represent the views of the post author. We reserve the right to delete any post deemed inappropriate or offensive and/or spammy. Please do not use abusive words/hate speech.

I Appreciate your valuable Feedback. So, Please DO NOT SPAM - Spam comments will be deleted immediately.

Don't use brand name in name field and you're not allowed to use links in comments unless it's necessary. Such comments will be removed immediately. To get notified of replies or follow-up comments, click the box next to notify me.