CS156: Intro to C, Part I

Spring 2018

Printf Expression

See this page as a slide show

Use of printf

printf can print constants, expressions, or values.

#include <stdio.h>

int main() {
    int value = 1+2*3+45/6;
    printf("The numbers are: %d, %d, %d, %d\n", 
        14, 1+2*3+45/6, value, value/2);
    return 0;
}
The numbers are: 14, 14, 14, 7

User: Guest

Check: HTML CSS
Edit History Source

Modified: 2017-02-24T10:08

Apply to CSU | Contact CSU | Disclaimer | Equal Opportunity
Colorado State University, Fort Collins, CO 80523 USA
© 2018 Colorado State University
CS Building