SlideShare a Scribd company logo
1 of 3
Programming in C and Data Structures Lab(15CPL16)
Ayesha Shariff, CSE, SECAB IET-2016 Page 1
Lab Program1: Design and develop a flowchart or an algorithm that takes three coefficients (a, b, and c) of a Quadratic equation
(ax2+bx+c=0) as input and compute all possible roots. Implement a C program for the developed flowchart/algorithm and execute
the same to output the possible roots for a given set of coefficients with appropriate messages.
Problem Analysis:General form of Quadratic equation is:ax2+bx+c=0, where a, b and c are three coefficients with real values.Here is
the criteria thatis used to determine all possibleroots to this equation:
Discriminant(d) Nature of roots Equation for roots
b2- 4ac > 0 Real &
distinct(unequal)
These solutions are: root1 =
−𝑏+√ 𝑏2 −4𝑎𝑐
2𝑎
root2 =
−𝑏−√ 𝑏2−4𝑎𝑐
2𝑎
b2- 4ac = 0 Real & equal root1=root2=-b/(2a)
b2- 4ac < 0 Imaginary(complex) x1=(realpart)+i(imaginarypart)
x2= (realpart)-i(imaginarypart)
where (realpart)=-b/(2a) and (imaginarypart)=sqrt(-d)/(2a) where d=b2-4ac
ALGORITHM
Step1: [Beginning of algorithm]
Start
Step2: [Read co-efficients]
Read a,b,c
Step3: [Find DiscriminantValue]
d=b2 – 4ac
If d>0 go to step 4
ElseIf d==0 go to step 5
Elsego to step 6
Step4: [Compute real and distinctroots]
root1=(-b+sqrt(d))/2a
root2=(-b-sqrt(d))/2a
Printroots arereal and distinct
Printroot1 and root2
Go to step 7
Step5: [Compute equal roots]
root1=root2=-b/2a
Printroots arereal and equal
Printroot1 and root2
Go to step 7
Step6: [Compute complex roots]
realpart=-b/2a
imagpart=(sqrt(-disc))/2a
root1= realpart+i*imagpart
root2= realpart- i*imagpart
Printroot1 and root2
Go to step 7
Step 7: [End of algorithm]
Stop
PROGRAM
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
floata, b, c, discriminant,root1,root2, realPart, imagPart;
clrscr();
printf("Enter non-zero coefficients a,b and c: ");
scanf("%f %f %f",&a, &b, &c);
discriminant=b*b-4*a*c;
// real and unequal roots
if (discriminant>0)
{
// sqrt() function returns squareroot
root1 = (-b+sqrt(discriminant))/(2*a);
root2 = (-b-sqrt(discriminant))/(2*a);
printf("Roots arereal and distinctn root1 = %f
andn root2 = %fn",root1 , root2);
}
//real and equal roots
else if (discriminant==0)
{
root1 = root2 = -b/(2*a);
printf("Roots arereal and equaln root1 = root2 =
%fn", root1);
}
// imaginary roots
else
{
realPart= -b/(2*a);
imagPart= sqrt(-discriminant)/(2*a);
printf("Roots arecomplex and distinctn root1 =
%f+i%f andn root2 = %f-i%fn", realPart,imagPart,realPart,
imagPart);
}
getch();
}
/********************Output********************
1. [x2 + 2x + 1 = 0 ]
Enter non-zero coefficients a,b and c: 1 2 1
Roots are real and equal
root1 = root2 = -1.000000
2. [ 2x2 + 5x + 2 = 0 ]
Enter non-zero coefficients a,b and c: 2 5 2
Roots are real and distinct
root1 = -0.500000 and
root2 = -2.000000
3. [ 2x2 + 2x + 2 = 0 ]
Enter non-zero coefficients a,b and c: 2 2 2
Roots are complex and distinct
root1 = -0.500000+i0.866025 and
root2 = -0.500000-i0.866025
*************************************************/
Programming in C and Data Structures Lab(15CPL16)
Ayesha Shariff, CSE, SECAB IET-2016 Page 2
Lab Program 2: Design and develop an algorithm to find the reverse of an integer number NUM and check whether it is
PALINDROME or NOT. Implement a C program for the developed algorithm that takes an integer number as input and output the
reverse of the same with suitable messages. Ex: Num: 2014, Reverse: 4102, Not a Palindrome
Problem Analysis: For a given integer number num, its reverse number (say rev) is obtained by writingits digits in reverse order.
For Example, for number 1234,the reverse number is 4321.An integer number is a palindromeif the reverse of that number is the
same as the number itself.Thus, the numbers 5, 22, 141 and 2442 arepalindromenumbers
Num Rem =Num%10 Rev=rev*10+rem Num=num/10
0 1234
1234 1234%10= 4 0*10+4=4 1234/10
123 123%10=3 4*10+3=43 123/10
12 12%10=2 43*10+2=432 12/10
1 1%10=1 432*10+1=4321 1/10
0 Stop the whileloop (end condition)
ALGORITHM
Step1: [Beginning of algorithm]
Start
Step2: [Read the number to reverse]
Read num
Step3: [Initialize]
temp=num
Step4: [Looping]
Repeat whilenum!=0
rem=num%10
rev=rev*10+rem
num=num/10
Step5: [Printreversed number]
Printreverse of given number
Step6: [Compare original number and reversed number]
If temp=rev then
Print‘num is palindrome‘
Else
Print‘num is not palindrome‘
Step 7: [End of algorithm]
Stop
PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
int n,num,rev=0,rem;
clrscr();
printf("Enter the numbern");
scanf("%d",&num);
n=num;
while(num != 0)
{
rem=num%10;
num = num/10;
rev=rev*10+rem;
}
printf("The reverse of given number %d is %dn",n,rev);
if(rev == n)
printf("The given number %d is a palindromen",n);
else
printf("The given number %d is not a
palindromen",n);
getch();
}
/****************OUTPUT**************
Enter the number
12321
The reverse of given number 12321 is 12321
The given number 12321 is a palindrome
Enter the number
1234
The reverse of given number 1231 is 4321
The given number 1234 is a not palindrome
*************************************/
************************************************************************************************************
Programming in C and Data Structures Lab(15CPL16)
Ayesha Shariff, CSE, SECAB IET-2016 Page 3
Lab Program 3a: Design and develop a flowchart to find the square root of given number n. Implement a C program for thesame
and execute for all possible inputs with appropriate messages. Note: Do not use library function sqrt(n)
ALGORITHM
Step1: [Beginning of algorithm]
Start
Step2: [Read a number]
Input num
Step3: [Check if positivenumber]
If num>=0
goto 4
else
goto 5
Step4: [Calculateand Printsquareroot]
sqroot=pow(num,0.5)
Printsqroot
Step5: [Printnot possibleto find square
root]
Print“cannot find squareroot”
Step 6: [End of algorithm]
Stop
FLOWCHART
PROGRAM
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
floatnum,sqroot;
printf("Enter the numbern");
scanf("%f",&num);
if(num>=0)
{
sqroot=pow(num,0.5);
printf("nSquareroot of a number %f is
%f",num,sqroot);
}
else
printf("nNot possibleto find square
root");
getch();
}
/**************OUTPUT************
Enter the number
4
Square root of 4.000000 is 2.000000
Enter the number
-1
Not possibleto find squarethe root
Enter the number to find the squareroot
23
Square root of 23.000000 is 4.795832
Lab Program 3b: Design and develop a C program to read a year as an input and find whether it is leap year or not. Also consider
end of the centuries.

More Related Content

What's hot

Practical write a c program to reverse a given number
Practical write a c program to reverse a given numberPractical write a c program to reverse a given number
Practical write a c program to reverse a given number
Mainak Sasmal
 

What's hot (19)

C Programming Language Part 8
C Programming Language Part 8C Programming Language Part 8
C Programming Language Part 8
 
Data Structures Practical File
Data Structures Practical File Data Structures Practical File
Data Structures Practical File
 
week-16x
week-16xweek-16x
week-16x
 
Function basics
Function basicsFunction basics
Function basics
 
C Programming Language Part 9
C Programming Language Part 9C Programming Language Part 9
C Programming Language Part 9
 
C Programming Language Step by Step Part 5
C Programming Language Step by Step Part 5C Programming Language Step by Step Part 5
C Programming Language Step by Step Part 5
 
VTU Data Structures Lab Manual
VTU Data Structures Lab ManualVTU Data Structures Lab Manual
VTU Data Structures Lab Manual
 
Data structures lab manual
Data structures lab manualData structures lab manual
Data structures lab manual
 
Implementing stack
Implementing stackImplementing stack
Implementing stack
 
C program
C programC program
C program
 
Core programming in c
Core programming in cCore programming in c
Core programming in c
 
C programming array & shorting
C  programming array & shortingC  programming array & shorting
C programming array & shorting
 
FUNCTIONS IN PYTHON[RANDOM FUNCTION]
FUNCTIONS IN PYTHON[RANDOM FUNCTION]FUNCTIONS IN PYTHON[RANDOM FUNCTION]
FUNCTIONS IN PYTHON[RANDOM FUNCTION]
 
Practical write a c program to reverse a given number
Practical write a c program to reverse a given numberPractical write a c program to reverse a given number
Practical write a c program to reverse a given number
 
C Programming Language Part 11
C Programming Language Part 11C Programming Language Part 11
C Programming Language Part 11
 
Inheritance and polymorphism
Inheritance and polymorphismInheritance and polymorphism
Inheritance and polymorphism
 
week-6x
week-6xweek-6x
week-6x
 
6. function
6. function6. function
6. function
 
Introduction to c part 2
Introduction to c   part  2Introduction to c   part  2
Introduction to c part 2
 

Similar to Cpl

Practical write a c program to reverse a given number
Practical write a c program to reverse a given numberPractical write a c program to reverse a given number
Practical write a c program to reverse a given number
Mainak Sasmal
 
C programs
C programsC programs
C programs
Minu S
 

Similar to Cpl (20)

Simple C programs
Simple C programsSimple C programs
Simple C programs
 
Cpds lab
Cpds labCpds lab
Cpds lab
 
C programming BY Mazedur
C programming BY MazedurC programming BY Mazedur
C programming BY Mazedur
 
4 operators, expressions &amp; statements
4  operators, expressions &amp; statements4  operators, expressions &amp; statements
4 operators, expressions &amp; statements
 
C lab-programs
C lab-programsC lab-programs
C lab-programs
 
Practical write a c program to reverse a given number
Practical write a c program to reverse a given numberPractical write a c program to reverse a given number
Practical write a c program to reverse a given number
 
2. operator
2. operator2. operator
2. operator
 
C Programming
C ProgrammingC Programming
C Programming
 
Cs291 assignment solution
Cs291 assignment solutionCs291 assignment solution
Cs291 assignment solution
 
All important c programby makhan kumbhkar
All important c programby makhan kumbhkarAll important c programby makhan kumbhkar
All important c programby makhan kumbhkar
 
Mathematics Function in C ,ppt
Mathematics Function in C ,pptMathematics Function in C ,ppt
Mathematics Function in C ,ppt
 
C programs
C programsC programs
C programs
 
Data Structure using C
Data Structure using CData Structure using C
Data Structure using C
 
C important questions
C important questionsC important questions
C important questions
 
Unit 5 Foc
Unit 5 FocUnit 5 Foc
Unit 5 Foc
 
901131 examples
901131 examples901131 examples
901131 examples
 
C - programming - Ankit Kumar Singh
C - programming - Ankit Kumar Singh C - programming - Ankit Kumar Singh
C - programming - Ankit Kumar Singh
 
C programming
C programmingC programming
C programming
 
sodapdf-converted into ppt presentation(1).pdf
sodapdf-converted into ppt presentation(1).pdfsodapdf-converted into ppt presentation(1).pdf
sodapdf-converted into ppt presentation(1).pdf
 
C code examples
C code examplesC code examples
C code examples
 

Recently uploaded

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Recently uploaded (20)

Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
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)
 
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
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
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Ă...
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
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
 
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
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 

Cpl

  • 1. Programming in C and Data Structures Lab(15CPL16) Ayesha Shariff, CSE, SECAB IET-2016 Page 1 Lab Program1: Design and develop a flowchart or an algorithm that takes three coefficients (a, b, and c) of a Quadratic equation (ax2+bx+c=0) as input and compute all possible roots. Implement a C program for the developed flowchart/algorithm and execute the same to output the possible roots for a given set of coefficients with appropriate messages. Problem Analysis:General form of Quadratic equation is:ax2+bx+c=0, where a, b and c are three coefficients with real values.Here is the criteria thatis used to determine all possibleroots to this equation: Discriminant(d) Nature of roots Equation for roots b2- 4ac > 0 Real & distinct(unequal) These solutions are: root1 = −𝑏+√ 𝑏2 −4𝑎𝑐 2𝑎 root2 = −𝑏−√ 𝑏2−4𝑎𝑐 2𝑎 b2- 4ac = 0 Real & equal root1=root2=-b/(2a) b2- 4ac < 0 Imaginary(complex) x1=(realpart)+i(imaginarypart) x2= (realpart)-i(imaginarypart) where (realpart)=-b/(2a) and (imaginarypart)=sqrt(-d)/(2a) where d=b2-4ac ALGORITHM Step1: [Beginning of algorithm] Start Step2: [Read co-efficients] Read a,b,c Step3: [Find DiscriminantValue] d=b2 – 4ac If d>0 go to step 4 ElseIf d==0 go to step 5 Elsego to step 6 Step4: [Compute real and distinctroots] root1=(-b+sqrt(d))/2a root2=(-b-sqrt(d))/2a Printroots arereal and distinct Printroot1 and root2 Go to step 7 Step5: [Compute equal roots] root1=root2=-b/2a Printroots arereal and equal Printroot1 and root2 Go to step 7 Step6: [Compute complex roots] realpart=-b/2a imagpart=(sqrt(-disc))/2a root1= realpart+i*imagpart root2= realpart- i*imagpart Printroot1 and root2 Go to step 7 Step 7: [End of algorithm] Stop PROGRAM #include<stdio.h> #include<conio.h> #include<math.h> void main() { floata, b, c, discriminant,root1,root2, realPart, imagPart; clrscr(); printf("Enter non-zero coefficients a,b and c: "); scanf("%f %f %f",&a, &b, &c); discriminant=b*b-4*a*c; // real and unequal roots if (discriminant>0) { // sqrt() function returns squareroot root1 = (-b+sqrt(discriminant))/(2*a); root2 = (-b-sqrt(discriminant))/(2*a); printf("Roots arereal and distinctn root1 = %f andn root2 = %fn",root1 , root2); } //real and equal roots else if (discriminant==0) { root1 = root2 = -b/(2*a); printf("Roots arereal and equaln root1 = root2 = %fn", root1); } // imaginary roots else { realPart= -b/(2*a); imagPart= sqrt(-discriminant)/(2*a); printf("Roots arecomplex and distinctn root1 = %f+i%f andn root2 = %f-i%fn", realPart,imagPart,realPart, imagPart); } getch(); } /********************Output******************** 1. [x2 + 2x + 1 = 0 ] Enter non-zero coefficients a,b and c: 1 2 1 Roots are real and equal root1 = root2 = -1.000000 2. [ 2x2 + 5x + 2 = 0 ] Enter non-zero coefficients a,b and c: 2 5 2 Roots are real and distinct root1 = -0.500000 and root2 = -2.000000 3. [ 2x2 + 2x + 2 = 0 ] Enter non-zero coefficients a,b and c: 2 2 2 Roots are complex and distinct root1 = -0.500000+i0.866025 and root2 = -0.500000-i0.866025 *************************************************/
  • 2. Programming in C and Data Structures Lab(15CPL16) Ayesha Shariff, CSE, SECAB IET-2016 Page 2 Lab Program 2: Design and develop an algorithm to find the reverse of an integer number NUM and check whether it is PALINDROME or NOT. Implement a C program for the developed algorithm that takes an integer number as input and output the reverse of the same with suitable messages. Ex: Num: 2014, Reverse: 4102, Not a Palindrome Problem Analysis: For a given integer number num, its reverse number (say rev) is obtained by writingits digits in reverse order. For Example, for number 1234,the reverse number is 4321.An integer number is a palindromeif the reverse of that number is the same as the number itself.Thus, the numbers 5, 22, 141 and 2442 arepalindromenumbers Num Rem =Num%10 Rev=rev*10+rem Num=num/10 0 1234 1234 1234%10= 4 0*10+4=4 1234/10 123 123%10=3 4*10+3=43 123/10 12 12%10=2 43*10+2=432 12/10 1 1%10=1 432*10+1=4321 1/10 0 Stop the whileloop (end condition) ALGORITHM Step1: [Beginning of algorithm] Start Step2: [Read the number to reverse] Read num Step3: [Initialize] temp=num Step4: [Looping] Repeat whilenum!=0 rem=num%10 rev=rev*10+rem num=num/10 Step5: [Printreversed number] Printreverse of given number Step6: [Compare original number and reversed number] If temp=rev then Print‘num is palindrome‘ Else Print‘num is not palindrome‘ Step 7: [End of algorithm] Stop PROGRAM #include<stdio.h> #include<conio.h> void main() { int n,num,rev=0,rem; clrscr(); printf("Enter the numbern"); scanf("%d",&num); n=num; while(num != 0) { rem=num%10; num = num/10; rev=rev*10+rem; } printf("The reverse of given number %d is %dn",n,rev); if(rev == n) printf("The given number %d is a palindromen",n); else printf("The given number %d is not a palindromen",n); getch(); } /****************OUTPUT************** Enter the number 12321 The reverse of given number 12321 is 12321 The given number 12321 is a palindrome Enter the number 1234 The reverse of given number 1231 is 4321 The given number 1234 is a not palindrome *************************************/ ************************************************************************************************************
  • 3. Programming in C and Data Structures Lab(15CPL16) Ayesha Shariff, CSE, SECAB IET-2016 Page 3 Lab Program 3a: Design and develop a flowchart to find the square root of given number n. Implement a C program for thesame and execute for all possible inputs with appropriate messages. Note: Do not use library function sqrt(n) ALGORITHM Step1: [Beginning of algorithm] Start Step2: [Read a number] Input num Step3: [Check if positivenumber] If num>=0 goto 4 else goto 5 Step4: [Calculateand Printsquareroot] sqroot=pow(num,0.5) Printsqroot Step5: [Printnot possibleto find square root] Print“cannot find squareroot” Step 6: [End of algorithm] Stop FLOWCHART PROGRAM #include<stdio.h> #include<conio.h> #include<math.h> void main() { floatnum,sqroot; printf("Enter the numbern"); scanf("%f",&num); if(num>=0) { sqroot=pow(num,0.5); printf("nSquareroot of a number %f is %f",num,sqroot); } else printf("nNot possibleto find square root"); getch(); } /**************OUTPUT************ Enter the number 4 Square root of 4.000000 is 2.000000 Enter the number -1 Not possibleto find squarethe root Enter the number to find the squareroot 23 Square root of 23.000000 is 4.795832 Lab Program 3b: Design and develop a C program to read a year as an input and find whether it is leap year or not. Also consider end of the centuries.