Keywords
Keywords are predefined, reserved words used in programming that have special meanings.
ex:- int money;
Here, int is a keyword that indicates money is a variable of type int (integer).
Identifiers
Identifier refers to name given to entities such as variables, functions, structures etc.
Variables
In programming, a variable is a container (storage area) to hold data.
ex:- int playerScore = 95;
Here, playerScore is a variable of int type
Constants
If you want to define a variable whose value cannot be changed, you can use the const keyword.
ex:- const double PI = 3.14;
Data Types
Data types are declarations for variables.This determines the type and size of data associated with variables.
Input Output (I/O)
use scanf() function to take input from the user, and printf() function to display output to the user
#include <stdio.h>
int main()
{
int a;
float b;
printf("Enter integer and then a float: ");
// Taking multiple inputs
scanf("%d%f", &a, &b);
printf("You entered %d and %f", a, b);
return 0;
}
Output
Enter integer and then a float: -3 3.4
You entered -3 and 3.400000
Programming Operators
An operator is a symbol that operates on a value or a variable.
Ex:- +,-, *,%
practice
C program to print a sentence
C program to print an integer entered by the user
C program to add two integers entered by the User
C program to multiply two floating-point numbers
C program to find ASCII value of a character entered by the user
C program to find quotient and remainder of Two Integers
C program to find the size of int, float, double and char
C program to swap two numbers
Comments
Post a Comment