What is C?
C is a general-purpose programming language created by Dennis Ritchie at
the Bell Laboratories in 1972.
It is a very popular language, despite being old. The main reason for its
popularity is because it is a fundamental language in the field of computer
science.
C is strongly associated with UNIX, as it was developed to write the UNIX
operating system.
1.Simple Program:
#include <stdio.h>
int main()
{
printf("Hello World!");
return 0;
}
2.Addition of TWO Numbers(Integers):
// C program to add two numbers
#include <stdio.h>
int main() {
int a, b, sum = 0;
// Read two numbers from the user
printf("Enter A Value: ");
printf(“Enter B Value: “);
scanf("%d", &a);
scanf("%d", &b);
// Calculate the addition of a and b
// using '+' operator
sum = a + b;
printf("Sum: %d", sum);
return 0;
}
3. Check weather given Number even or odd
#include <stdio.h>
void main()
{
int n;
printf("Enter a number: ");
scanf("%d", &n);
if(n % 2 == 0)
printf("%d is even number.", n);
else
printf("%d is odd number.", n);
}