What is variable ? Explain the type of variables with example.

What is variable ?

  • A variable is a named storage location in computer memory that holds a value. Variables are used to store and manipulate data in a program. 
Explain the type of variables with example. 

Type of variables with example: 

  • Integers Type : int

Example: int age = 25;

  • Floating-point numbers : float

Example: float temperature = 98.6;

  • double:

Example: double pi = 3.14159265359;

  • Individual characters: char

Example: char grade = 'A';

  • Boolean values: bool

Example: bool isStudent = true;






0 Comments:

Post a Comment