SlideShare ist ein Scribd-Unternehmen logo
1 von 13
Downloaden Sie, um offline zu lesen
SOLUTION PROGRAMMING IN ANSI C: (Balagurusamy)
CHAPTER-1
Problem exercise no 1.1&1.2:
Coding of the programme:
#include<stdio.h>
#include<conio.h>
void main()
{
printf("---------------------------------------n");
printf("I First line :A.Z.M.Shakilur Rahman InI Second line :12/a ,Ali
sonar lane InI Third line:Bogra,5800 In");
printf("---------------------------------------");
getch();
}
Output:
Problem exercise no. 1.3:
Coding of the programme:
#include<stdio.h>
#include<conio.h>
void main()
{clrscr();
printf("*n* *n* * *n* * * * ");
getch();
}
Output:
*
* *
* * *
* * * *
Problem exercise no :1.4
Coding of the problem:
#include<stdio.h>
#include<conio.h>
void main()
{clrscr();
printf("a>>------------------>b");
getch();
}
Output:
a>>------------------>b
Problem exercise no:1.5
Coding of the problem:
#include<stdio.h>
#include<conio.h>
#define pi 3.14159
void main()
{
float r,A;
clrscr();
printf("ntENTER THE RADIUS OF A CIRCLE=");
scanf("%f",&r);
A=pi*r*r;
printf("nntArea=%f sqr unit",A);
getch();
}
Output:
ENTER THE RADIUS OF A CIRCLE=2
Area=12.566360 sqr unit
Problem exercise no:1.6
CODING:
#include<stdio.h>
#include<conio.h>
void main()
{
int b,c;
clrscr();
for(b=1;b<=10;b++)
{
c=5*b;
printf("nt%d*%d=%dn",5,b,c);
getch();
}
}
Output :
Problem exercise no:1.7
Coding of the programme:
#include<stdio.h>
#include<conio.h>
void add();
void sub();
void main()
{
clrscr();
add();
sub();
getch();
}
void add()
{
printf("nt%d+%d=%d",20,10,30);
}
void sub()
{
printf("nt%d-%d=%d",20,10,10);
}
Output :
20+10=30
20-10=10
Problem exercise no:1.8
Coding:
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,x;
clrscr();
printf("Enter values of a,b&cn");
scanf("%d%d%d",&a,&b,&c);
x=a/(b-c);
printf("result=%d",x);
getch();
}
Output:
a)
Enter values of a,b&c
250
85
25
result=4
b)NO OUTPUT
Problem exercise no:1.9 (b)
Coding :
#include<stdio.h>
#include<conio.h>
void main()
{
float a,F,C;
clrscr();
printf("ENTER TEMPERATURE IN FARENHITEn");
scanf("%f",&F);
a=5*(F-32);
C=a/9;
printf("nIn celsius scale=%f",C);
getch();
}
Output :
ENTER TEMPERATURE IN FARENHITE
10
In Celsius scale=-12.222222
Problem exercise no:1.9 (a)
Coding :
#include<stdio.h>
#include<conio.h>
void main()
{
float a,F,C;
clrscr();
printf("ENTER TEMPERATURE IN CELSIUSn");
scanf("%f",&C);
a=(9*C)/5;
F=a+32;
printf("nIn farenhite scale=%f",F);
getch();
}
Output:
ENTER TEMPERATURE IN CELSIUS
10
In frenhite scale=50.00000
Problem exercise no: 1.10
Coding of the problem:
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
float a,b,c,S,A;
printf("ntENTER 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("ntArea of the triangle=%f",A);
getch();
}
Sample output:
ENTER THE THREE SIDES OF A TRIANGLE=10
12
14
Area of the triangle=58.787754
Problem exercise no:1.11
Coding:
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float D,x1,x2,y1,y2;
printf("ENTER CO-ORDINATES x1,x2,y1,y2=n");
scanf("%f%f%f%f",&x1,&x2,&y1,&y2);
D=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
printf("Result=%f",D);
getch();
}
Output :
ENTER CO-ORDINATES x1,x2,y1,y2=
2 4 8 5
Result=3.605551
Problem exercise no:1.12
Coding:
#include<stdio.h>
#include<conio.h>
#include<math.h>
#define pi 3.14159
void main()
{
float r,x1,x2,y1,y2,A;
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
Problem exercise no:1.13
Coding:
#include<stdio.h>
#include<conio.h>
#include<math.h>
#define pi 3.14159
void main()
{ float D,r,x1,x2,y1,y2,A;
x1=2;
x2=2;
y1=5;
y2=6;
D=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
r=D/2;
A=pi*r*r;
printf("Result=%f",A);
getch();
}
Output :
Result=0.785398
Problem exercise no:1.14
Coding:
#include<stdio.h>
#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
Problem exercise no:1.15
Coding:
#include<stdio.h>
#include<conio.h>
void main()
{ float x,y,sum,difference,product,division;
clrscr();
printf("ENTER TWO NUMBERS=n");
scanf("%f%f",&x,&y);
sum=x+y;
difference=x-y;
product=x*y;
division=x/y;
printf("ntSum=%ftDifference=%fnntProduct=%ftDivision=%f",su
m,difference,product,division);
getch();
}
Output :
ENTER TWO NUMBERS=
10 5
Sum=15.000000 Difference=5.000000
Product=50.000000 Division=2.000000
Reference:
http://hstuadmission.blogspot.com/2010/12/solution-programming-in-
ansi-c-chapter.html

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Let us c chapter 4 solution
Let us c chapter 4 solutionLet us c chapter 4 solution
Let us c chapter 4 solution
 
The solution manual of programming in ansi by Robin
The solution manual of programming in ansi by RobinThe solution manual of programming in ansi by Robin
The solution manual of programming in ansi by Robin
 
Let us c (by yashvant kanetkar) chapter 1 solution
Let us c (by yashvant kanetkar) chapter 1 solutionLet us c (by yashvant kanetkar) chapter 1 solution
Let us c (by yashvant kanetkar) chapter 1 solution
 
Let us c(by yashwant kanetkar) chapter 2 solution
Let us c(by yashwant kanetkar) chapter 2 solutionLet us c(by yashwant kanetkar) chapter 2 solution
Let us c(by yashwant kanetkar) chapter 2 solution
 
Chapter 5 exercises Balagurusamy Programming ANSI in c
Chapter 5 exercises Balagurusamy Programming ANSI  in cChapter 5 exercises Balagurusamy Programming ANSI  in c
Chapter 5 exercises Balagurusamy Programming ANSI in c
 
The solution manual of c by robin
The solution manual of c by robinThe solution manual of c by robin
The solution manual of c by robin
 
Let us c(by Yashwant Kanetkar) 5th edition solution chapter 1
Let us c(by Yashwant Kanetkar) 5th edition solution chapter 1Let us c(by Yashwant Kanetkar) 5th edition solution chapter 1
Let us c(by Yashwant Kanetkar) 5th edition solution chapter 1
 
TDD in C - Recently Used List Kata
TDD in C - Recently Used List KataTDD in C - Recently Used List Kata
TDD in C - Recently Used List Kata
 
Programming in C Presentation upto FILE
Programming in C Presentation upto FILEProgramming in C Presentation upto FILE
Programming in C Presentation upto FILE
 
Let us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solution
Let us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solutionLet us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solution
Let us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solution
 
Functions in c language
Functions in c language Functions in c language
Functions in c language
 
Function C programming
Function C programmingFunction C programming
Function C programming
 
Printing different pyramid patterns of numbers,alphabets and stars using C.
Printing different pyramid patterns of numbers,alphabets and stars using C.Printing different pyramid patterns of numbers,alphabets and stars using C.
Printing different pyramid patterns of numbers,alphabets and stars using C.
 
FUNCTIONS IN C PROGRAMMING.pdf
FUNCTIONS IN C PROGRAMMING.pdfFUNCTIONS IN C PROGRAMMING.pdf
FUNCTIONS IN C PROGRAMMING.pdf
 
Programming in C Basics
Programming in C BasicsProgramming in C Basics
Programming in C Basics
 
CONDITIONAL STATEMENT IN C LANGUAGE
CONDITIONAL STATEMENT IN C LANGUAGECONDITIONAL STATEMENT IN C LANGUAGE
CONDITIONAL STATEMENT IN C LANGUAGE
 
Functions in c
Functions in cFunctions in c
Functions in c
 
C Programming
C ProgrammingC Programming
C Programming
 
Strings in c
Strings in cStrings in c
Strings in c
 
VTU Data Structures Lab Manual
VTU Data Structures Lab ManualVTU Data Structures Lab Manual
VTU Data Structures Lab Manual
 

Ähnlich wie Chapter 1 : Balagurusamy_ Programming ANsI in C

Bti1022 lab sheet 3
Bti1022 lab sheet 3Bti1022 lab sheet 3
Bti1022 lab sheet 3
alish sha
 
prg5,6,.doc computer science and engineering
prg5,6,.doc computer science and engineeringprg5,6,.doc computer science and engineering
prg5,6,.doc computer science and engineering
SUNITHAS81
 
Assignment no39
Assignment no39Assignment no39
Assignment no39
Jay Patel
 
C Prog - Strings
C Prog - StringsC Prog - Strings
C Prog - Strings
vinay arora
 
C Prog. - Strings (Updated)
C Prog. - Strings (Updated)C Prog. - Strings (Updated)
C Prog. - Strings (Updated)
vinay arora
 
Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7
alish sha
 

Ähnlich wie Chapter 1 : Balagurusamy_ Programming ANsI in C (20)

Muzzammilrashid
MuzzammilrashidMuzzammilrashid
Muzzammilrashid
 
Write a program that reads in integer as many as the user enters from.docx
Write a program that reads in integer as many as the user enters from.docxWrite a program that reads in integer as many as the user enters from.docx
Write a program that reads in integer as many as the user enters from.docx
 
Bti1022 lab sheet 3
Bti1022 lab sheet 3Bti1022 lab sheet 3
Bti1022 lab sheet 3
 
prg5,6,.doc computer science and engineering
prg5,6,.doc computer science and engineeringprg5,6,.doc computer science and engineering
prg5,6,.doc computer science and engineering
 
Adding two integers in c
Adding two integers in cAdding two integers in c
Adding two integers in c
 
c++ practical Digvajiya collage Rajnandgaon
c++ practical  Digvajiya collage Rajnandgaonc++ practical  Digvajiya collage Rajnandgaon
c++ practical Digvajiya collage Rajnandgaon
 
Technical quiz 5#.pptx
Technical quiz 5#.pptxTechnical quiz 5#.pptx
Technical quiz 5#.pptx
 
Assignment no39
Assignment no39Assignment no39
Assignment no39
 
C test
C testC test
C test
 
Review Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfReview Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdf
 
C Prog - Strings
C Prog - StringsC Prog - Strings
C Prog - Strings
 
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORYCS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
 
C Prog. - Strings (Updated)
C Prog. - Strings (Updated)C Prog. - Strings (Updated)
C Prog. - Strings (Updated)
 
Functions in c
Functions in cFunctions in c
Functions in c
 
Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7
 
UNIT-II CP DOC.docx
UNIT-II CP DOC.docxUNIT-II CP DOC.docx
UNIT-II CP DOC.docx
 
Lab 2
Lab 2Lab 2
Lab 2
 
Labsheet_3
Labsheet_3Labsheet_3
Labsheet_3
 
LAB1.docx
LAB1.docxLAB1.docx
LAB1.docx
 
12th CBSE Practical File
12th CBSE Practical File12th CBSE Practical File
12th CBSE Practical File
 

Mehr von BUBT

Mehr von BUBT (12)

Lab report cover page
Lab report cover page Lab report cover page
Lab report cover page
 
Project report title cover page
Project report title cover pageProject report title cover page
Project report title cover page
 
Implementation Of GSM Based Fire Alarm and Protection System
Implementation Of GSM Based Fire Alarm and Protection SystemImplementation Of GSM Based Fire Alarm and Protection System
Implementation Of GSM Based Fire Alarm and Protection System
 
Student Attendance
Student AttendanceStudent Attendance
Student Attendance
 
Reasoning for Artificial Intelligence Expert
Reasoning for Artificial Intelligence ExpertReasoning for Artificial Intelligence Expert
Reasoning for Artificial Intelligence Expert
 
Auto Room Lighting and Door lock Report
Auto Room Lighting and Door lock ReportAuto Room Lighting and Door lock Report
Auto Room Lighting and Door lock Report
 
Auto Room Lighting System
Auto Room Lighting SystemAuto Room Lighting System
Auto Room Lighting System
 
Doorlock
DoorlockDoorlock
Doorlock
 
Ultra Dense Netwok
Ultra Dense NetwokUltra Dense Netwok
Ultra Dense Netwok
 
Bangladesh University of Business and Technology
Bangladesh University of Business and Technology Bangladesh University of Business and Technology
Bangladesh University of Business and Technology
 
Art Gallery Management System
Art Gallery Management SystemArt Gallery Management System
Art Gallery Management System
 
Shop management system
Shop management systemShop management system
Shop management system
 

Kürzlich hochgeladen

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Kürzlich hochgeladen (20)

Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 

Chapter 1 : Balagurusamy_ Programming ANsI in C

  • 1. SOLUTION PROGRAMMING IN ANSI C: (Balagurusamy) CHAPTER-1 Problem exercise no 1.1&1.2: Coding of the programme: #include<stdio.h> #include<conio.h> void main() { printf("---------------------------------------n"); printf("I First line :A.Z.M.Shakilur Rahman InI Second line :12/a ,Ali sonar lane InI Third line:Bogra,5800 In"); printf("---------------------------------------"); getch(); } Output: Problem exercise no. 1.3: Coding of the programme: #include<stdio.h> #include<conio.h> void main() {clrscr(); printf("*n* *n* * *n* * * * ");
  • 2. getch(); } Output: * * * * * * * * * * Problem exercise no :1.4 Coding of the problem: #include<stdio.h> #include<conio.h> void main() {clrscr(); printf("a>>------------------>b"); getch(); } Output: a>>------------------>b Problem exercise no:1.5 Coding of the problem: #include<stdio.h> #include<conio.h>
  • 3. #define pi 3.14159 void main() { float r,A; clrscr(); printf("ntENTER THE RADIUS OF A CIRCLE="); scanf("%f",&r); A=pi*r*r; printf("nntArea=%f sqr unit",A); getch(); } Output: ENTER THE RADIUS OF A CIRCLE=2 Area=12.566360 sqr unit Problem exercise no:1.6 CODING: #include<stdio.h> #include<conio.h> void main() { int b,c; clrscr();
  • 4. for(b=1;b<=10;b++) { c=5*b; printf("nt%d*%d=%dn",5,b,c); getch(); } } Output : Problem exercise no:1.7 Coding of the programme: #include<stdio.h> #include<conio.h> void add(); void sub(); void main() { clrscr(); add(); sub(); getch(); } void add()
  • 5. { printf("nt%d+%d=%d",20,10,30); } void sub() { printf("nt%d-%d=%d",20,10,10); } Output : 20+10=30 20-10=10 Problem exercise no:1.8 Coding: #include<stdio.h> #include<conio.h> void main() { int a,b,c,x; clrscr(); printf("Enter values of a,b&cn"); scanf("%d%d%d",&a,&b,&c); x=a/(b-c); printf("result=%d",x);
  • 6. getch(); } Output: a) Enter values of a,b&c 250 85 25 result=4 b)NO OUTPUT Problem exercise no:1.9 (b) Coding : #include<stdio.h> #include<conio.h> void main() { float a,F,C; clrscr(); printf("ENTER TEMPERATURE IN FARENHITEn"); scanf("%f",&F); a=5*(F-32); C=a/9; printf("nIn celsius scale=%f",C);
  • 7. getch(); } Output : ENTER TEMPERATURE IN FARENHITE 10 In Celsius scale=-12.222222 Problem exercise no:1.9 (a) Coding : #include<stdio.h> #include<conio.h> void main() { float a,F,C; clrscr(); printf("ENTER TEMPERATURE IN CELSIUSn"); scanf("%f",&C); a=(9*C)/5; F=a+32; printf("nIn farenhite scale=%f",F); getch(); } Output: ENTER TEMPERATURE IN CELSIUS
  • 8. 10 In frenhite scale=50.00000 Problem exercise no: 1.10 Coding of the problem: #include<stdio.h> #include<conio.h> #include<math.h> void main() { clrscr(); float a,b,c,S,A; printf("ntENTER 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("ntArea of the triangle=%f",A); getch(); } Sample output: ENTER THE THREE SIDES OF A TRIANGLE=10 12 14
  • 9. Area of the triangle=58.787754 Problem exercise no:1.11 Coding: #include<stdio.h> #include<conio.h> #include<math.h> void main() { float D,x1,x2,y1,y2; printf("ENTER CO-ORDINATES x1,x2,y1,y2=n"); scanf("%f%f%f%f",&x1,&x2,&y1,&y2); D=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); printf("Result=%f",D); getch(); } Output : ENTER CO-ORDINATES x1,x2,y1,y2= 2 4 8 5 Result=3.605551 Problem exercise no:1.12 Coding: #include<stdio.h> #include<conio.h>
  • 10. #include<math.h> #define pi 3.14159 void main() { float r,x1,x2,y1,y2,A; 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 Problem exercise no:1.13 Coding: #include<stdio.h> #include<conio.h> #include<math.h> #define pi 3.14159
  • 11. void main() { float D,r,x1,x2,y1,y2,A; x1=2; x2=2; y1=5; y2=6; D=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); r=D/2; A=pi*r*r; printf("Result=%f",A); getch(); } Output : Result=0.785398 Problem exercise no:1.14 Coding: #include<stdio.h> #include<conio.h> void main() { int a,b,c; clrscr(); a=5; b=8;
  • 12. c=18; printf("%dx+%dy=%d",a,b,c); getch(); } Output : 5x+8y=18 Problem exercise no:1.15 Coding: #include<stdio.h> #include<conio.h> void main() { float x,y,sum,difference,product,division; clrscr(); printf("ENTER TWO NUMBERS=n"); scanf("%f%f",&x,&y); sum=x+y; difference=x-y; product=x*y; division=x/y; printf("ntSum=%ftDifference=%fnntProduct=%ftDivision=%f",su m,difference,product,division); getch(); }
  • 13. Output : ENTER TWO NUMBERS= 10 5 Sum=15.000000 Difference=5.000000 Product=50.000000 Division=2.000000 Reference: http://hstuadmission.blogspot.com/2010/12/solution-programming-in- ansi-c-chapter.html