C PROGRAMMING
What is C language
The C programming language is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC PDP-11 computer in 1972. In 1978, Brian Kernighan and Dennis Ritchie produced the first publicly available description of C, now known as the K&R standard. The UNIX operating system, the C compiler, and essentially all UNIX applications programs have been written in C. The C has now become a widely used professional language for various reasons.
What is Header file
In C programming, a header file is a file containing declarations of functions, variables, macros, and other identifiers that are intended to be shared across multiple source files. Header files typically have a .h extension.
ex-: #include<stdio.h>
What is Main Function
The main() function in C is the designated entry point where program execution begins. Every C program must contain a main() function.
ex-: main( )
printf( )
scanf( )
What is Variables & Constants
A variable is nothing but a name given to a storage area that our programs can
manipulate. Each variable in C has a specific type, which determines the size and layout
of the variable's memory; the range of values that can be stored within that memory;
and the set of operations that can be applied to the variable.
int a = 2
float b = 4.5
char c = 'R'
string d = 'ramesh'
What is Formula
In C, "formulas" are implemented using operators (+, -, *, /, %) for basic math, functions (like pow(), sqrt() from <math.h>) for complex operations, or defined macros (#define) for constants/expressions, all within your main function or custom functions, following C syntax for variables and data types (e.g., int, double) to perform calculations and produce results
What is comment
Comments in C are used to add explanatory notes within the code, making it more understandable for humans. The C compiler ignores comments during compilation, so they do not affect the program's execution.
Practical - 01
Write a program to add two number 60 and 40, display result on screen.
#include<stdio.h>
main()
{
int a,b,c;
a=90, b=60;
c=a+b;
printf("addition of two number=%d\n\n",c);
}
Practical - 02
Write a program to add, subtract, divide and multiply two numbers 50 and 20, display result separately on screen.
Practical - 03
Write a program to display addition of two number entered by user on screen.
#include<stdio.h>
main()
{
int a,b,c;
printf("PLEASE ENTER FIRST NUMBER=");
scanf("%d",&a);
printf("PLEASE ENTER SECOND NUMBER=");
scanf("%d",&b);
c=a+b;
printf("addition of two number=%d",c);
Practical - 04
Write a program to find gross salary of a person if basic salary is enterd by user. TA=10% of basic salary, DA=500 and HRA= 12% of basic salary.