Solution Programming in Ansi C: Chapter-1: Problem Exercise No 1.1&1.2: Coding of The Programme
Solution Programming in Ansi C: Chapter-1: Problem Exercise No 1.1&1.2: Coding of The Programme
ANSI C: CHAPTER-1
Problem exercise no 1.1&1.2:
Coding of the programme:
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("---------------------------------------\n");
printf("I First line :A.Z.M.Shakilur Rahman I\nI Second line :12/a ,Ali sonar lane
I\nI Third line:Bogra,5800
I\n");
printf("---------------------------------------");
getch();
}
Output:
getch();
}
Output:
a>>------------------>b
Output:
ENTER THE RADIUS OF A CIRCLE=2
Area=12.566360 sqr unit
#include<stdio.h>
#include<conio.h>
void add();
void sub();
void main()
{
clrscr();
add();
sub();
getch();
}
void add()
{
printf("\n\t%d+%d=%d",20,10,30);
}
void sub()
{
printf("\n\t%d-%d=%d",20,10,10);
}
Output :
20+10=30
20-10=10
Output:
a)
Enter values of a,b&c
250
85
25
result=4
b)NO OUTPUT
Output :
ENTER TEMPERATURE IN FARENHITE
10
In Celsius scale=-12.222222
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
float a,b,c,S,A;
printf("\n\tENTER THE THREE SIDES OF A TRIANGLE=");
scanf("%f%f%f",&a,&b,&c);
S=(a+b+c)/2;
A=sqrt(S*(S-a)*(S-b)*(S-c));
printf("\n\tArea of the triangle=%f",A);
getch();
}
Sample output:
ENTER THE THREE SIDES OF A TRIANGLE=10
12
14
Area of the triangle=58.787754
Output :
ENTER CO-ORDINATES x1,x2,y1,y2=
2
4
8
5
Result=3.605551
#include<conio.h>
#include<math.h>
#define pi 3.14159
void main()
{
float r,x1,x2,y1,y2,A;
clrscr();
x1=0;
x2=0;
y1=4;
y2=5;
r=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
A=pi*r*r;
printf("Result=%f",A);
getch();
}
Output :
Result=3.14159
Output :
Result=0.785398
#include<conio.h>
void main()
{ int a,b,c;
clrscr();
a=5;
b=8;
c=18;
printf("%dx+%dy=%d",a,b,c);
getch();
}
Output :
5x+8y=18
Output :
ENTER TWO NUMBERS=
10
5
Sum=15.000000
Difference=5.000000
Product=50.000000
Division=2.000000