C Programming Example - Print Integer | Tutorial
Tutorial -- Learning not just technology, but dreams!
- Home
- HTML
- JavaScript
- CSS
- Vue
- React
- Python3
- Java
- C
- C++
- C#
- AI
- Go
- SQL
- Linux
- VS Code
- Bootstrap
- Git
- Local Bookmarks
C Tutorial
C Tutorial C Introduction C Environment Setup C VScode C Program Structure C Basic Syntax C Data Types C Variables C Constants C Storage Classes C Operators C Decision Making C Loops C Functions C Scope Rules C Arrays C enum(Enumeration) C Pointers C Function Pointers & Callback Functions C Strings C Structures C Unions C Bit Fields C typedef C Input & Output C File I/O C Preprocessors C Header Files C Type Casting C Error Handling C Recursion C Variable Arguments C Memory Management C Undefined Behavior C Command Line Arguments C Safe Functions C Sorting Algorithms C Project Structure C Examples C Classic 100 Examples C Quiz
C Standard Library
C Standard Library - Reference Manual <a href="#" title="C Standard Library - ">C Standard Library - <a href="#" title="C Standard Library - ">C Standard Library - <a href="#" title="C Standard Library - ">C Standard Library - <a href="#" title="C Standard Library - ">C Standard Library - <a href="#" title="C Standard Library - ">C Standard Library - <a href="#" title="C Standard Library - ">C Standard Library - <a href="#" title="C Standard Library -
C Programming Example - Print Integer
Use printf() with %d to format and output an integer.
Example
#include<stdio.h>
int main()
{
int number;
// printf() outputs a string
printf("Enter an integer: ");
// scanf() formats the input
scanf("%d", &number);
// printf() displays the formatted input
printf("You entered: %d", number);
return 0;
}
Output:
Enter an integer: 45
You entered: 45
Click to Share Notes
Write notes...
Image URL
Image Description
Share Notes
- Nickname Nickname (Required)
- Email Email (Required)
- Reference URL Reference URL
YouTip