[go: up one dir, main page]

0% found this document useful (0 votes)
18 views2 pages

C Basic Programs

C is a general-purpose programming language developed by Dennis Ritchie in 1972, widely used in computer science and closely associated with UNIX. The document includes simple C programs demonstrating basic functionalities such as printing text, adding two integers, and checking if a number is even or odd. C remains popular due to its foundational role in programming and operating systems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views2 pages

C Basic Programs

C is a general-purpose programming language developed by Dennis Ritchie in 1972, widely used in computer science and closely associated with UNIX. The document includes simple C programs demonstrating basic functionalities such as printing text, adding two integers, and checking if a number is even or odd. C remains popular due to its foundational role in programming and operating systems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

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);
}

You might also like