SlideShare a Scribd company logo
1 of 7
 Quadractic Equation
 Bisection Method
int main()
{
float a,b,c,D,x,y;
clrscr();
printf(“Enter the coefficient of x2, coefficient of x and constant”);
scanf(“%f%f”,&a, &b, &c);
D=(b*b)-(4*a*c);
if(D<0)
{
printf(“Roots are Imagenary”);
}
if(D==0)
{
printf(“Both Roots are Same”);
x =(-b)/(2*a);
printf(“%f”, x);
}
if(D>0)
{
printf(“Both Roots are Real and Distinct:”);
x= (-b) + sqrt(D)/2*a;
y= (-b) - sqrt(D)/2*a;
printf(“%f%f”, x,y);
}
getch();
return 0;
}
#include<stdio.h>
#define e 0.001
#define f(x) x*x*x -4*x +1
void main()
{
float x0,x1,x2;
float f0,f1,f2;
clrscr();
printf(“Enter the values of x0 and x1”);
scanf(“%f%f”,&x0,&x1);
do{
f0 = f(x0);
f1 = f(x1);
x2=(x0+x1)/2;
f2=f(x2);
if(f0*f2<0)
{
x1=x2;
}
else
{
x0=x2;
}
i++;
printf(“No. of Iterations:=%d”,i);
printf(“Root:=%f”,x2);
printf(“Value of function =%fn”,f2);
}while(fabs(f2)<e);
getch();
Computer lab (programs)
Computer lab (programs)
Computer lab (programs)

More Related Content

What's hot (20)

Vcs9
Vcs9Vcs9
Vcs9
 
LAB PROGRAMS SARASWATHI RAMALINGAM
LAB PROGRAMS SARASWATHI RAMALINGAMLAB PROGRAMS SARASWATHI RAMALINGAM
LAB PROGRAMS SARASWATHI RAMALINGAM
 
Random. Kinda.
Random. Kinda.Random. Kinda.
Random. Kinda.
 
Ejercicios de programacion
Ejercicios de programacionEjercicios de programacion
Ejercicios de programacion
 
Rombo matriz
Rombo matrizRombo matriz
Rombo matriz
 
Basic program in java
Basic program in java Basic program in java
Basic program in java
 
week-21x
week-21xweek-21x
week-21x
 
Session06 functions
Session06 functionsSession06 functions
Session06 functions
 
Numerical Methods in C
Numerical Methods in CNumerical Methods in C
Numerical Methods in C
 
Cpp tutorial
Cpp tutorialCpp tutorial
Cpp tutorial
 
Single linked list
Single linked listSingle linked list
Single linked list
 
Introduction to Processing and creative coding
Introduction to Processing and creative codingIntroduction to Processing and creative coding
Introduction to Processing and creative coding
 
cosc 281 hw2
cosc 281 hw2cosc 281 hw2
cosc 281 hw2
 
Circular linked list
Circular linked listCircular linked list
Circular linked list
 
201801 CSE240 Lecture 09
201801 CSE240 Lecture 09201801 CSE240 Lecture 09
201801 CSE240 Lecture 09
 
Blocks+gcd入門
Blocks+gcd入門Blocks+gcd入門
Blocks+gcd入門
 
SATySFiのこれからの課題たち
SATySFiのこれからの課題たちSATySFiのこれからの課題たち
SATySFiのこれからの課題たち
 
10 2 배열 응용
10 2 배열 응용10 2 배열 응용
10 2 배열 응용
 
Cpp
Cpp Cpp
Cpp
 
New presentation oop
New presentation oopNew presentation oop
New presentation oop
 

Similar to Computer lab (programs)

Similar to Computer lab (programs) (20)

Cquestions
Cquestions Cquestions
Cquestions
 
C questions
C questionsC questions
C questions
 
Assignment on Numerical Method C Code
Assignment on Numerical Method C CodeAssignment on Numerical Method C Code
Assignment on Numerical Method C Code
 
C programming BY Mazedur
C programming BY MazedurC programming BY Mazedur
C programming BY Mazedur
 
Cpds lab
Cpds labCpds lab
Cpds lab
 
C lab manaual
C lab manaualC lab manaual
C lab manaual
 
C Prog - Pointers
C Prog - PointersC Prog - Pointers
C Prog - Pointers
 
C Programming lab
C Programming labC Programming lab
C Programming lab
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manual
 
C basics
C basicsC basics
C basics
 
Computer graphics lab assignment
Computer graphics lab assignmentComputer graphics lab assignment
Computer graphics lab assignment
 
โปรแกรมย่อยและฟังชันก์มาตรฐาน
โปรแกรมย่อยและฟังชันก์มาตรฐานโปรแกรมย่อยและฟังชันก์มาตรฐาน
โปรแกรมย่อยและฟังชันก์มาตรฐาน
 
Cg my own programs
Cg my own programsCg my own programs
Cg my own programs
 
C Programming Exam problems & Solution by sazzad hossain
C Programming Exam problems & Solution by sazzad hossainC Programming Exam problems & Solution by sazzad hossain
C Programming Exam problems & Solution by sazzad hossain
 
Cpl
CplCpl
Cpl
 
ADA FILE
ADA FILEADA FILE
ADA FILE
 
C programms
C programmsC programms
C programms
 
C lab programs
C lab programsC lab programs
C lab programs
 
C lab programs
C lab programsC lab programs
C lab programs
 
LET US C (5th EDITION) CHAPTER 2 ANSWERS
LET US C (5th EDITION) CHAPTER 2 ANSWERSLET US C (5th EDITION) CHAPTER 2 ANSWERS
LET US C (5th EDITION) CHAPTER 2 ANSWERS
 

More from mshoaib15

Msc prev completed
Msc prev completedMsc prev completed
Msc prev completedmshoaib15
 
Msc prev updated
Msc prev updatedMsc prev updated
Msc prev updatedmshoaib15
 
Msc chemistry previous
Msc chemistry previousMsc chemistry previous
Msc chemistry previousmshoaib15
 
Bsc math previous exam quetions
Bsc math previous exam quetionsBsc math previous exam quetions
Bsc math previous exam quetionsmshoaib15
 
What is algorithm
What is algorithmWhat is algorithm
What is algorithmmshoaib15
 
Boolean expression org.
Boolean expression org.Boolean expression org.
Boolean expression org.mshoaib15
 
Number system....
Number system....Number system....
Number system....mshoaib15
 

More from mshoaib15 (8)

Msc prev completed
Msc prev completedMsc prev completed
Msc prev completed
 
Msc prev updated
Msc prev updatedMsc prev updated
Msc prev updated
 
Msc chemistry previous
Msc chemistry previousMsc chemistry previous
Msc chemistry previous
 
Bsc math previous exam quetions
Bsc math previous exam quetionsBsc math previous exam quetions
Bsc math previous exam quetions
 
Function
FunctionFunction
Function
 
What is algorithm
What is algorithmWhat is algorithm
What is algorithm
 
Boolean expression org.
Boolean expression org.Boolean expression org.
Boolean expression org.
 
Number system....
Number system....Number system....
Number system....
 

Recently uploaded

SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 

Recently uploaded (20)

SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 

Computer lab (programs)

  • 1.
  • 2.  Quadractic Equation  Bisection Method
  • 3. int main() { float a,b,c,D,x,y; clrscr(); printf(“Enter the coefficient of x2, coefficient of x and constant”); scanf(“%f%f”,&a, &b, &c); D=(b*b)-(4*a*c); if(D<0) { printf(“Roots are Imagenary”); } if(D==0) { printf(“Both Roots are Same”); x =(-b)/(2*a); printf(“%f”, x); } if(D>0) { printf(“Both Roots are Real and Distinct:”); x= (-b) + sqrt(D)/2*a; y= (-b) - sqrt(D)/2*a; printf(“%f%f”, x,y); } getch(); return 0; }
  • 4. #include<stdio.h> #define e 0.001 #define f(x) x*x*x -4*x +1 void main() { float x0,x1,x2; float f0,f1,f2; clrscr(); printf(“Enter the values of x0 and x1”); scanf(“%f%f”,&x0,&x1); do{ f0 = f(x0); f1 = f(x1); x2=(x0+x1)/2; f2=f(x2); if(f0*f2<0) { x1=x2; } else { x0=x2; } i++; printf(“No. of Iterations:=%d”,i); printf(“Root:=%f”,x2); printf(“Value of function =%fn”,f2); }while(fabs(f2)<e); getch();