Hello guys today I will tell you about Computer Languages that are very important for job nowdays for everyone whether it is for computer science students or BCA students or BSC , BBA , Mechanical or any field.
So let's start to know about Computer first. Did you guys know that computer understand language of only 0's and 1's. Yes this is called binary numbers. Whenever you give some instructions to your computer it will convert this instructions into machine readable language and then for displaying it again convert that machine language into human readable language. So this is just a basic things to know about Computer. Let's starts to talk about the technical languages.
Computer Languages Are -
C is a computer language which used to develop programs without worry about hardware platforms which is designed by Dennis Ritchie.
C has keywords(have fixed meaning) like if , int, for, float, else, main, void, char etc.
C has variables , you can give name to any variables but there are some rules to declare that variables like
Syntax to write a program in C -
#include<stdio.in> Void main() {
Statements;
}
Examples-
1.Write a program to display hello world.
#include<stdio.h>
Void main()
{
printf("Hello World");
}
Output of this program is-
Hello World
2.Write a program to display addition of two numbers.(Accept the numbers from the user)
#include<stdio.h>
Void main()
{
int firstnumber;
int secondnumber;
int Sum;
printf("Enter first number -");
scanf("%d",&fisrtnumber);
printf("Enter second number -");
scanf("%d",& secondnumber);
Sum = firstnumber + secondnumber ;
printf("Addition of two numbers = %d" ,Sum);
}
printf is used for printing or displaying statement on the monitor. Used for output.
scanf is used to take inputs from user.
Output of this program is -
Enter first number - 10
Enter second number - 55
Addition of two numbers = 65
2. Write a program to calculate square of a number and cube of a number.
Void main()
{
int a = 10;
int square , cube;
square = a x a ;
cube = a x a x a;
printf("Square =%d", square);
printf("Cube =%d", cube);
}
Output of this program is -
Square = 100
Cube = 1000
If you want to know more about C language or any other languages then let me know in the comment section 🤗❤️