Home Python C Language C ++ HTML 5 CSS Javascript Java Kotlin SQL DJango Bootstrap React.js R C# PHP ASP.Net Numpy Dart Pandas Digital Marketing

First C Program


Writing your first C program is an exciting introduction to programming in one of the most widely-used languages. C provides a solid foundation for understanding programming concepts and working with systems programming. Here are three simple examples to get you started with C programming.

Example 1: Hello, World!

The "Hello, World!" program is a classic beginner program that displays a message on the screen. Here’s how it’s done in C:

Explanation: This program includes the standard I/O library, <stdio.h>, which contains the printf function. The main function is where the program begins, and printf is used to print "Hello, World!" to the screen.

Example 2: Simple Addition

This program performs a simple addition of two numbers and displays the result. It introduces basic variable usage and arithmetic operations in C.

Explanation: This program defines two integer variables, num1 and num2, assigns them values, and calculates their sum. The printf function then displays the result.

Example 3: User Input

This example introduces scanf, a function that allows the program to accept user input. The program asks the user for their age and then prints it back to them.

Code:

Explanation: This program uses scanf to read an integer from the user and store it in the variable age. It then uses printf to display the entered age back to the user.








Q3 Schools : India


Online Complier

HTML 5

Python

java

C++

C

JavaScript

Website Development

HTML

CSS

JavaScript

Python

SQL

Campus Learning

C

C#

java