What is const in C?
The const keyword is used to make a variable read-only (its value cannot be changed after initialization).
It tells the compiler: βThis variableβs value should not be modified.β
Trying to change a const variable will usually give a compile-time error.
Example: Using const with a variable
#include <stdio.h>
int main() {
const int x = 10; // constant integer
printf("Value of x: %d\n", x);
// x = 20; // β Error: assignment of read-only variable
return 0;
}
β
Output:
Value of x: 10
1 - 1
Python program that converts Decimal Number System to Octal Number System:
decimal_num = int(input("Enter a decimal number: "))
octal_num = oct(decimal_num)
print("Octal representation:", octal_num)
Sample Output:
Enter a decimal number: 25
Octal representation: 0o31
0 - 5
A compiler translates the entire source code into machine code at once, while an interpreter translates and executes code line by line.
2 - 1
C program to Calculate Simple Interest:
Find the error
#include <stdio.h>
int main() {
float p, r, t, si;
printf("Enter Principal, Rate and Time: ");
scanf("%f %f %f", &p, &r, t);
si = (p * r * t) / 100;
printf("Simple Interest = %f\n", si);
return 0;
}
Comment down your answer
1 - 5
Variable Declaration, Initialization and Assignment in C
1. Variable Declaration
Tells the compiler the name and type of a variable (reserves memory).
Does not always assign a value.
π Example:
int age; // Declares an integer variable 'age'
float salary; // Declares a floating-point variable 'salary'
2. Variable Initialization
Means giving an initial value to a variable at the time of declaration.
π Example:
int age = 20; // age is declared and initialized to 20
float salary = 5000.5; // salary is declared and initialized
3. Variable Assignment
Means storing a value into a variable (after it has been declared).
Can happen anywhere in the program.
π Example:
int age; // Declaration
age = 25; // Assignment after declaration
1 - 1
π Welcome to Atish Jain β Coding Tutorials in Telugu & English
π Powered by AH CAREER ACADEMY β Academy of Skills
Hi, Iβm Atish Jain, Co-Founder of AH CAREER ACADEMY. Weβre on a mission to deliver high-quality technical education on computer programming languages like C, C++, Java, Python, SQL, and more
π― What Youβll Find Here:
β
Beginner to Advanced Programming Tutorials
β
Real-Time Coding Examples & Exercises
β
Placement Preparation Guidance
β
Technical Interview Questions
β
Conceptual Explanations in Regional Language (Telugu)
π§βπ« All our content is original and professionally recorded. We strictly oppose copyright violation and maintain the highest standards in educational integrity.
π Website: atishjain.in
π± WhatsApp: +91 99491 28444
π§ Business & Copyright Inquiries: contact@atishjain.in
π Subscribe to stay updated with our latest videos and boost your coding skills with ease.
Letβs learn, grow, and build a better future β one line of code at a time!