1. Programming in C 1322174
SignaturePage 1
PROGRAM – 1
A programming language defines a set of instructions that are compiled together to Performa specific
tasks by the CPU (central Processing Unit). The programming language mainly refers to high – level
languages such as C, C++, Pascal, Ada, COBOL , etc .
Each Programming languages contains a unique set of keywords and syntax, which are used to create a
set of instructions. Thousands of programming languages have been developed till now, but each
languages has its specific purpose . These languages vary in t the level of abstraction they provide from
the hardware . Some programming languages provide less or no abstracton while some provide higher
abstraction . Based on the levels of abstraction, they can be classified into two categories:
Low – level language
High – level language
LOW-LEVEL LANGUAGES
The low level languages is a programming languages that provides no abstraction from the
hardware, and it is represent in 0 and 1 forms , which are the machine instructions . The
languages that come under this category are the Machine level languages and Assembly
languages.
HIGH – LEVEL LANGUAGES
The high- level language is a programming language that allows a programmer to write the programs
which are independent of a particular type of computer . The high-level languages are considered as
high- level languages because they are closer to human languages than machine – level languages .
When writing a program in a high – level language , then the whole attention needs to be paid to the
logic of the problem .
A compiler is required to translate a high – level language into a low – level language .
PROGRAM STRUCTURE
3. Programming in C 1322174
SignaturePage 3
PROGRAM – 2
AIM:-Write a program to print “hello world ”
#include<stdio.h>
#include<conio.h>
Int main()
{
Printf(“Hello world”);
}
getch();
output
PROGRAM -3
AIM:-Write a program to add a two number.
4. Programming in C 1322174
SignaturePage 4
#include<stdio.h>
#include<conio.h>
Int main()
{
Int a, b, sum;
Printf(“a”);
Scanf(“%d”,&a);
Printf(“b”);
Scanf(“%d”,&b);
Sum=a+b;
Printf(“%d”,sum);
Getch();
}
OUTPUT
PROGRAM-4
AIM:-Write a program to subtract two number
#include<stdio.h>
5. Programming in C 1322174
SignaturePage 5
#include<conio.h>
Int main()
{
Int a, b, sub;
Printf(“a”);
Scanf(“%d”,&a);
Printf(“b”);
Scanf(“%d”,&b);
Sub=a-b;
Printf(“%d”,sub);
Getch();
}
OUTPUT
PROGRAM-5
AIM:- Write a program multiple to two number
#include<stdio.h>
#include<conio.h>
6. Programming in C 1322174
SignaturePage 6
Int main()
{
Int a, b, multiply;
Printf(“a”);
Scanf(“%d”,&a);
Printf(“b”);
Scanf(“%d”,&b);
multiply=a*b;
Printf(“%d”,multiply);
Getch();
}
OUTPUT
PROGRAM-6
AIM:-Write a program to Divide a two number
#include<stdio.h>
#include<conio.h>
Int main()
7. Programming in C 1322174
SignaturePage 7
{
Int a, b, div;
Printf(“a”);
Scanf(“%d”,&a);
Printf(“b”);
Scanf(“%d”,&b);
div=a/b;
Printf(“%d”,div);
Getch();
}
OUTPUT
PROGRAM -7
AIM:-Write a program area of circle
#include<stdio.h>
#include<conio.h>
Int main()
8. Programming in C 1322174
SignaturePage 8
{
Float r , area;
Printf(“r”);
Scanf(“%f”,&r);
Area=3.14*r*r;
Printf(“%f”,area);
Getch();
}
OUTPUT
PROGRAM-8
AIM:-Write a program of area of square
#include<stdio.h>
#include<conio.h>
Int main()
{
9. Programming in C 1322174
SignaturePage 9
Int a , area;
Printf(“a”);
Scanf(“%d”,&a);
Area=a*a
Printf(“%d”,area);
Getch();
}
OUTPUT
PROGRAM-9
AIM:-Program to Print an Integer
#include<stdio.h>
Int main()
{
Printf(“Enter an integer”);
// reads and stores input
10. Programming in C 1322174
SignaturePage 10
Scanf(“%d”,&number);
//displays output
Printf(“you entered:%d”,number);
Return0:
}
OUTPUT
PROGRAM-10
AIM:-Program to compute Quotient and Remainder
#include<stdio.h>
Int main(){
Int dividend, divisor , quotient , remainder;
Printf(“Enter dividend:”);
Scanf(“%d”, ÷nd);
Printf(“Enter divisor:”);
11. Programming in C 1322174
SignaturePage 11
Scanf(“%d”, &divisor);
// computes quotient
Quotient = dividend / divisor;
//computes remainder
remainder= dividend % divisor;
printf(“Quotients = %dn”, quotient);
printf(“Remainder = %d”, remainder);
return0;
}
OUTPUT
Program – 11
AIM:-Program to Find the size of variable.
#include<stdio.h>
int main(){
int intType;
float floatType;
double doubleType;
12. Programming in C 1322174
SignaturePage 12
char charType;
//sizeof evaluates the size of a variable
printf("Size of int: %zu bytes/n", sizeof(intType));
printf("Size of float: %zu bytes/n", sizeof(floatType));
printf("Size of double: %zu bytes/n", sizeof(doubleType));
printf("Size of char: %zu bytes/n", sizeof(charType));
return 0;
}
OUTPUT