Solution for Exercise 5-1
ex0501
#include <stdio.h>
int main()
{
printf("The value %d is an integer.\n",986);
printf("The value %f is a float.\n",98.6);
return(0);
}
Output
The value 986 is an integer.
The value 98.600000 is a float.
Notes
* Two items are used in both printf() functions that don't display as shown in the source code: conversion characters and escape characters.
* Conversion characters are prefixed by a % (percent sign), escape characters are prefixed by a \ (backslash).
* Conversion characters can also be called placeholders.
* To display a % in a string, you must specify two % characters, %%. Even the pros forget to do that from time to time. So to print 50% you use this statement:
Or:
* Likewise, to display a \ in a string, you must specify two of them, \\.
Copyright © 1997-2025 by QPBC.
All rights reserved
