Introduction:
What is C Language?
In
computing C is a
general purpose programming language developed by Dennis Ritchie at
“AT & T’s Bell Laboratories” of USA in 1972.
This
language was created for a specific purpose i.e. to design the UNIX operating system.
The UNIX operating system and virtually all UNIX applications are written in
the C language. C has now become a widely used professional language for
various reasons which are:
· Easy to learn
· Structured language
· It can handle low-level
activities.
· It can be compiled on a variety of
computers.
Some
Facts about C Language
· C was basically invented to write
an operating system called UNIX.
· C language is a successor of B
language which was introduced around 1970
· The language was formalized in
1988 by the American National Standard Institute (ANSI).
· C is a procedural language.
· Today C is the most widely used
System Programming Language.
· C language influenced most of the
modern world programming languages which include the mighty C++ and Java as
well.
Now let’s
create a program to calculate sum of two numbers using C language
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,sum;
clrsrc();
printf("Enter value of a=");
scanf("%d",&a);
printf(" Enter value of b=");
scanf("%d",&b);
sum=a+b;
printf("Sum of %d and %d = %d"a,b,sum);
getch();
}
Run the program using ctrl+F9
Output will be:
Enter value of a= 50
Enter value of b= 30
Sum of 50 and 30 = 80
#include<conio.h>
void main()
{
int a,b,sum;
clrsrc();
printf("Enter value of a=");
scanf("%d",&a);
printf(" Enter value of b=");
scanf("%d",&b);
sum=a+b;
printf("Sum of %d and %d = %d"a,b,sum);
getch();
}
Run the program using ctrl+F9
Output will be:
Enter value of a= 50
Enter value of b= 30
Sum of 50 and 30 = 80
0 comments:
Post a Comment