Plot No.2, Sector 17-A, Yamuna Expressway, Greater Noida, Gautam Buddh Nagar, U.P., India
School of Computing Science and
Engineering
Lab Report
Exploration with CAS-I
BCS01T1003_PR
B.Tech. (First Sem.2022-2023)
Submitted by: Submitted to: Dr . Monika
Jain
Name: Syed Fuzail
Batch: 20
Adm. No.:22SCSE1011555
Lab Sheet #1
Q1: Write a program to display “hello world” in C.
Program 1:
// Syed Fuzail
// 22SCSE1011555
#include <stdio.h>
int main()
{
printf("Hello world");
return 0;
}
Output :
Q2: Write a program to add two numbers (5&7) and
display it’s sum.
Program 2:
// Syed Fuzail
// 22SCSE1011555
#include <stdio.h>
int main()
{
int a=5,b=7,sum;
sum=a+b;
printf("Sum equals to %d",sum);
return 0;
}
Output:
Q3: Write a program to multiply two numbers (10&8)
and display its result.
Program 3:
// Syed Fuzail
// 22SCSE1011555
#include <stdio.h>
int main()
{
int a=10,b=8,product;
product=a*b;
printf("Product equals to %d",product);
return 0;
}
Output:
Q4: Write a program to calculate the area of a circle of
radius (r=5).
Program 4:
// Syed Fuzail
// 22SCSE1011555
#include <stdio.h>
int main()
{
int radius=5;
float area;
area=2*3.14*radius;
printf("Area of cirlce equals to %f",area);
return 0;
}
Output:
Q5: Write a program to calculate area of an ellipse having
it’s axes (minor=4cm, major=6cm).
Program 5:
// Syed Fuzail
// 22SCSE1011555
#include <stdio.h>
int main()
{
int major=6,minor=4;
float area;
area=3.14*major*minor;
printf("Area of ellipse equals to %f",area);
return 0;
}
Output:
Q6: Write a program to calculate simple interest for a given
P=4000, T=2, r=5.5.
Program 6:
// Syed Fuzail
// 22SCSE1011555
#include <stdio.h>
int main()
{
int p=4000,t=2;
float si,r=5.5;
si=(p*r*t)/100;
printf("Simple Intrest equals to %f",si);
return 0;
}
Output:
Lab Sheet #2
Q1:Write a program to declare two integer and one float
variable then intialize them to 10, 15, 12.6. Also print the
values in the screen.
Program 1:
// Syed Fuzail
// 22SCSE1011555
#include <stdio.h>
int main()
{
int a=10,b=15;
float c=12.6;
printf("Integer values are n%d n%d nFloat value aren%f",a,b,c);
return 0;
}
Output:
Q2:Write a C program to prompt the user to input 3 integer
values and print these values in forward and reversed order.
Program 2:
// Syed Fuzail
// 22SCSE1011555
#include <stdio.h>
int main()
{
int a,b,c;
printf("Enter three integer number");
scanf("%d%d%d",&a,&b,&c);
printf("Forward order %d %d %dn",a,b,c);
printf("Reverse order %d %d %d",c,b,a);
return 0;
}
Output:
Q3:Write a program to calculate simple and compound
interest.
Program 3:
// Syed Fuzail
// 22SCSE1011555
#include <stdio.h>
#include<math.h>
int main()
{
int p,r,t;
float si,ci;
printf("Enter the principle, rate, time to calculate the simple and
compond intrest");
scanf("%d%d%d",&p,&r,&t);
si=(p*r*t)/100;
ci=p*pow((1+ r/100),t);
printf("Simple intrest equals to %f nCompound intrest equals
to %f",si,ci);
return 0;
}
Output:
Q4:Write a program to swap two variables' values with and
without using third variables.
(a) With Variable
Program 4(a):
// Syed Fuzail
// 22SCSE1011555
#include <stdio.h>
int main()
{
int a,b,c;
printf("Enterthe value of a and b respectively to swap the value");
scanf("%d%d",&a,&b);
c=a;
a=b;
printf("n Swapped value of a=%d",a);
b=c;
printf("nSwapped value of b=%d",b);
return 0;
}
Output:
(b) Without third variable:
Program 4(b):
// Syed Fuzail
// 22SCSE1011555
#include <stdio.h>
int main()
{
int a,b;
printf("Enter the value of a and b respectively to swap the value");
scanf("%d%d",&a,&b);
a=a+b;
b=a-b;
a=a-b;
printf("n Swapped value of a=%d",a);
printf("nSwapped value of b=%d",b);
return 0;
}
Output:
Q5: Write a program to check odd or even number (a)
using modulus operator (b) using bitwise operator (c)
without using bitwise and modulus operator (d) using
conditional operator.
Program 5(a):
// Syed Fuzail
// 22SCSE1011555
#include <stdio.h>
int main()
{
int x;
printf("n Enter any number to check it is a odd number or even
number.");
scanf("%d",&x);
if(x%2==0)
{
printf("n Entered number %d is a even number.",x);
}
else
{
printf("n Entered number %d is a odd number.",x);
}
return 0;
}
Output:
Program 5(b):
// Syed Fuzail
// 22SCSE1011555
#include <stdio.h>
int main()
{
int x;
printf("n Enter any number to check it is a odd number or even
number.");
scanf("%d",&x);
if((x & 1)==1)
{
printf("n Entered number %d is a odd number.",x);
}
else
{
printf("n Entered number %d is a even number.",x);
}
return 0;
}
Output:
Program 5(c):
// Syed Fuzail
// 22SCSE1011555
#include <stdio.h>
int main()
{
int x;
printf("n Enter any number to check it is a odd number or even
number.");
scanf("%d",&x);
if((x>>1)<<1==x)
{
printf("n Entered number %d is a even number.",x);
}
else
{
printf("n Entered number %d is a odd number.",x);
}
return 0;
}
Output:
Program 5(d):
// Syed Fuzail
// 22SCSE1011555
#include <stdio.h>
int main()
{
int x;
printf("n Enter any number to check it is a odd number or even
number.");
scanf("%d",&x);
printf("The number is %s",(x%2==0 ? "EVEN" : "ODD"));
return 0;
}
Output:
Q6. Print the value of y for given x=2 & z=4 and analyze
the output.
a. y = x++ + ++x;
b. y= ++x + ++x;
c. y= ++x + ++x + ++x;
d. y = x>z;
e. y= x>z? x:z;
f. y = x&z;
g. y= x>>2 + z<<1;
Program 6: Output:
// Syed Fuzail
// 22SCSE1011555
#include <stdio.h>
int main()
{
int x=2,z=4,y;
y=x++ + ++x;
printf("(a) Solution %dn",y);
y=++x + ++x;
printf("(b) Solution %dn",y);
y=++x + ++x + ++x;
printf("(c) Solution %d n",y);
y=x>2;
printf("(d) Solution %d n",y);
y=x>z ? x:z;
printf("(e) Solution %d n",y);
y=x&z;
printf("(f) Solution %d n",y);
y=x>>2 + z<<1;
printf("(g) Solution %d n",y);
return 0;
}
Q7. Write a program to print the size of char, float, double
and long double data types in C.
Program 7:
#include <stdio.h>
int main()
{
char a;
float b;
double c;
long double d;
printf("Enter any character n");
scanf("%c",&a);
printf("Enter any decimal valuen");
scanf("%f",&b);
printf("Enter any long value with decimaln");
scanf("%ld",&c);
printf("Enter any extra long value n");
scanf("%ld",&d);
return 0;
}
Output:
Lab Sheet #3
Q1.Write a program to find the largest and smallest among
three entered numbers and also display whether the
identified largest/smallest number is even or odd.
Program 1:
//Syed Fuzail
//22SCSE1011555
#include <stdio.h>
int main()
{
int a,b,c;
printf("Enter any three numbers.n");
scanf("%d%d%d",&a,&b,&c);
if(a>b && a>c)
{
printf("%d is greater than %d and %dn",a,b,c);
if(a%2==0)
{
printf("%d is evenn",a);
}
else
{
printf("%d is oddn",a);
}
}
if(b>c && b>a)
{
printf("%d is greater than %d and %dn",b,a,c);
if(b%2==0)
{
printf("%d is evenn",b);
}
else
{
printf("%d is oddn",b);
}
}
if(c>a && c>b)
{
printf("%d is greater than %d and %d",c,a,b);
if(c%2==0)
{
printf("%d is evenn",c);
}
else
{
printf("%d is oddn",c);
}
}
if(a<b && a<c)
{
printf("%d is smaller than %d and %dn",a,b,c);
if(a%2==0)
{
printf("%d is evenn",a);
}
else
{
printf("%d is oddn",a);
}
}
if(b<c && b<c)
{
printf("%d is smaller than %d and %dn",b,a,c);
if(a%2==0)
{
printf("%d is evenn",b);
}
else
{
printf("%d is oddn",b);
}
}
if(c<b && c<a)
{
printf("%d is smaller than %d and %dn",c,a,b);
if(c%2==0)
{
printf("%d is evenn",c);
}
else
{
printf("%d is oddn",c);
}
}
return 0;
}
Output:
Q2:Write a program to check whether input alphabet is
vowel or not using if-else and switch statement.
Program 2:
Using If-else statement
//Syed Fuzail
//22SCSE1011555
#include <stdio.h>
int main()
{
char v;
printf("Enter any alphabet.n");
scanf("%c",&v);
if(v=='a'||v=='e'||v=='i'||v=='o'||v=='u'||v=='A'||v=='E'||v=='I'||v=='O'||
v=='U')
{
printf("Entered alphabet %c is vowel.",v);
}
else
{
printf("Entered alphabet %c is consonant",v);
}
return 0;
}
Output:
Using Switch Statement
//Syed Fuzail
//22SCSE1011555
#include <stdio.h>
int main()
{
char v;
printf("Enter any alphabet.n");
scanf("%c",&v);
switch(v)
{
case'a':
printf("Vowel");
break;
case'e':
printf("Vowel");
break;
case'i':
printf("Vowel");
break;
case'o':
printf("Vowel");
break;
case'u':
printf("Vowel");
break;
case'A':
printf("Vowel");
break;
case'E':
printf("Vowel");
break;
case'I':
printf("Vowel");
break;
case'O':
printf("Vowel");
break;
case'U':
printf("Vowel");
break;
default:
printf("Consonant");
}
return 0;
}
Output:
Q3. Write a program to get input of two or higher digit
integer number and display in reverse order.
Program 3:
// Syed Fuzail
//22SCSE1011555
#include <stdio.h>
int main()
{
int n, reverse = 0, remainder;
printf("Enter an integer: ");
scanf("%d", &n);
while (n != 0)
{
remainder = n % 10;
reverse = reverse * 10 + remainder;
n /= 10;
}
printf("Reversed number = %d", reverse);
return 0;
}
Output:
Q4. Write a program that asks a number and test the
number whether it is multiple of 5 or not, divisible by 7 but
not by eleven.
Program 4:
//Syed Fuzail
//22SCSE1011555
#include <stdio.h>
int main()
{
int n;
printf("Enter any number.n");
scanf("%d",&n);
if(n%5==0)
{
printf("%d is multiple of 5. n",n);
}
else
{
printf("%d is not multiple of 5.n",n);
}
if((n%7==0)&& (n%11!=0))
{
printf("Given Number is also divisible by 7 but not by 11.");
}
else
{
printf("Not divisible by 7 and 11");
}
return 0;
}
Output:
Q5. Write a program to check whether the entered year is
leap year or not (a year is leap if it is divisible by 4 and
divisible by 100 or 400.)
Program 5:
//Syed Fuzail
//22SCSE1011555
#include <stdio.h>
int main()
{
int a;
printf("Enter any year to check leap year or not");
scanf("%d",&a);
if((a%4==0)||(a%400==0)&&(a%100==0))
{
printf("n %d is a leap year",a);
}
else
{
printf("n %d is not a leap year",a);
}
return 0;
}
Output:
Q6. Write a program to read the values of coefficients a, b
and c of a quadratic equation ax2+bx+c=0 and find roots of
the equation.
Program 6:
//Syed Fuzail
//22SCSE1011555
#include <math.h>
#include <stdio.h>
int main() {
double a, b, c, discriminant, root1, root2, realPart, imagPart;
printf("Enter coefficients a, b and c: ");
scanf("%lf %lf %lf", &a, &b, &c);
discriminant = b * b - 4 * a * c;
// condition for real and different roots
if (discriminant > 0) {
root1 = (-b + sqrt(discriminant)) / (2 * a);
root2 = (-b - sqrt(discriminant)) / (2 * a);
printf("root1 = %.2lf and root2 = %.2lf", root1, root2);
}
// condition for real and equal roots
else if (discriminant == 0) {
root1 = root2 = -b / (2 * a);
printf("root1 = root2 = %.2lf;", root1);
}
// if roots are not real
else {
realPart = -b / (2 * a);
imagPart = sqrt(-discriminant) / (2 * a);
printf("root1 = %.2lf+%.2lfi and root2 = %.2f-%.2fi", realPart,
imagPart, realPart, imagPart);
}
return 0;
}
Output:

Fuzail_File_C.docx

  • 1.
    Plot No.2, Sector17-A, Yamuna Expressway, Greater Noida, Gautam Buddh Nagar, U.P., India School of Computing Science and Engineering Lab Report Exploration with CAS-I BCS01T1003_PR B.Tech. (First Sem.2022-2023) Submitted by: Submitted to: Dr . Monika Jain Name: Syed Fuzail Batch: 20 Adm. No.:22SCSE1011555
  • 2.
    Lab Sheet #1 Q1:Write a program to display “hello world” in C. Program 1: // Syed Fuzail // 22SCSE1011555 #include <stdio.h> int main() { printf("Hello world"); return 0; } Output :
  • 3.
    Q2: Write aprogram to add two numbers (5&7) and display it’s sum. Program 2: // Syed Fuzail // 22SCSE1011555 #include <stdio.h> int main() { int a=5,b=7,sum; sum=a+b; printf("Sum equals to %d",sum); return 0; } Output:
  • 4.
    Q3: Write aprogram to multiply two numbers (10&8) and display its result. Program 3: // Syed Fuzail // 22SCSE1011555 #include <stdio.h> int main() { int a=10,b=8,product; product=a*b; printf("Product equals to %d",product); return 0; } Output:
  • 5.
    Q4: Write aprogram to calculate the area of a circle of radius (r=5). Program 4: // Syed Fuzail // 22SCSE1011555 #include <stdio.h> int main() { int radius=5; float area; area=2*3.14*radius; printf("Area of cirlce equals to %f",area); return 0; } Output:
  • 6.
    Q5: Write aprogram to calculate area of an ellipse having it’s axes (minor=4cm, major=6cm). Program 5: // Syed Fuzail // 22SCSE1011555 #include <stdio.h> int main() { int major=6,minor=4; float area; area=3.14*major*minor; printf("Area of ellipse equals to %f",area); return 0; } Output:
  • 7.
    Q6: Write aprogram to calculate simple interest for a given P=4000, T=2, r=5.5. Program 6: // Syed Fuzail // 22SCSE1011555 #include <stdio.h> int main() { int p=4000,t=2; float si,r=5.5; si=(p*r*t)/100; printf("Simple Intrest equals to %f",si); return 0; } Output:
  • 8.
    Lab Sheet #2 Q1:Writea program to declare two integer and one float variable then intialize them to 10, 15, 12.6. Also print the values in the screen. Program 1: // Syed Fuzail // 22SCSE1011555 #include <stdio.h> int main() { int a=10,b=15; float c=12.6; printf("Integer values are n%d n%d nFloat value aren%f",a,b,c); return 0; } Output:
  • 9.
    Q2:Write a Cprogram to prompt the user to input 3 integer values and print these values in forward and reversed order. Program 2: // Syed Fuzail // 22SCSE1011555 #include <stdio.h> int main() { int a,b,c; printf("Enter three integer number"); scanf("%d%d%d",&a,&b,&c); printf("Forward order %d %d %dn",a,b,c); printf("Reverse order %d %d %d",c,b,a); return 0; } Output:
  • 10.
    Q3:Write a programto calculate simple and compound interest. Program 3: // Syed Fuzail // 22SCSE1011555 #include <stdio.h> #include<math.h> int main() { int p,r,t; float si,ci; printf("Enter the principle, rate, time to calculate the simple and compond intrest"); scanf("%d%d%d",&p,&r,&t); si=(p*r*t)/100; ci=p*pow((1+ r/100),t); printf("Simple intrest equals to %f nCompound intrest equals to %f",si,ci); return 0; } Output:
  • 11.
    Q4:Write a programto swap two variables' values with and without using third variables. (a) With Variable Program 4(a): // Syed Fuzail // 22SCSE1011555 #include <stdio.h> int main() { int a,b,c; printf("Enterthe value of a and b respectively to swap the value"); scanf("%d%d",&a,&b); c=a; a=b; printf("n Swapped value of a=%d",a); b=c; printf("nSwapped value of b=%d",b); return 0; } Output:
  • 12.
    (b) Without thirdvariable: Program 4(b): // Syed Fuzail // 22SCSE1011555 #include <stdio.h> int main() { int a,b; printf("Enter the value of a and b respectively to swap the value"); scanf("%d%d",&a,&b); a=a+b; b=a-b; a=a-b; printf("n Swapped value of a=%d",a); printf("nSwapped value of b=%d",b); return 0; } Output:
  • 13.
    Q5: Write aprogram to check odd or even number (a) using modulus operator (b) using bitwise operator (c) without using bitwise and modulus operator (d) using conditional operator. Program 5(a): // Syed Fuzail // 22SCSE1011555 #include <stdio.h> int main() { int x; printf("n Enter any number to check it is a odd number or even number."); scanf("%d",&x); if(x%2==0) { printf("n Entered number %d is a even number.",x); } else { printf("n Entered number %d is a odd number.",x); } return 0; } Output:
  • 14.
    Program 5(b): // SyedFuzail // 22SCSE1011555 #include <stdio.h> int main() { int x; printf("n Enter any number to check it is a odd number or even number."); scanf("%d",&x); if((x & 1)==1) { printf("n Entered number %d is a odd number.",x); } else { printf("n Entered number %d is a even number.",x); } return 0; } Output:
  • 15.
    Program 5(c): // SyedFuzail // 22SCSE1011555 #include <stdio.h> int main() { int x; printf("n Enter any number to check it is a odd number or even number."); scanf("%d",&x); if((x>>1)<<1==x) { printf("n Entered number %d is a even number.",x); } else { printf("n Entered number %d is a odd number.",x); } return 0; } Output:
  • 16.
    Program 5(d): // SyedFuzail // 22SCSE1011555 #include <stdio.h> int main() { int x; printf("n Enter any number to check it is a odd number or even number."); scanf("%d",&x); printf("The number is %s",(x%2==0 ? "EVEN" : "ODD")); return 0; } Output:
  • 17.
    Q6. Print thevalue of y for given x=2 & z=4 and analyze the output. a. y = x++ + ++x; b. y= ++x + ++x; c. y= ++x + ++x + ++x; d. y = x>z; e. y= x>z? x:z; f. y = x&z; g. y= x>>2 + z<<1; Program 6: Output: // Syed Fuzail // 22SCSE1011555 #include <stdio.h> int main() { int x=2,z=4,y; y=x++ + ++x; printf("(a) Solution %dn",y); y=++x + ++x; printf("(b) Solution %dn",y); y=++x + ++x + ++x; printf("(c) Solution %d n",y); y=x>2; printf("(d) Solution %d n",y); y=x>z ? x:z; printf("(e) Solution %d n",y); y=x&z; printf("(f) Solution %d n",y); y=x>>2 + z<<1; printf("(g) Solution %d n",y); return 0; }
  • 18.
    Q7. Write aprogram to print the size of char, float, double and long double data types in C. Program 7: #include <stdio.h> int main() { char a; float b; double c; long double d; printf("Enter any character n"); scanf("%c",&a); printf("Enter any decimal valuen"); scanf("%f",&b); printf("Enter any long value with decimaln"); scanf("%ld",&c); printf("Enter any extra long value n"); scanf("%ld",&d); return 0; } Output:
  • 19.
    Lab Sheet #3 Q1.Writea program to find the largest and smallest among three entered numbers and also display whether the identified largest/smallest number is even or odd. Program 1: //Syed Fuzail //22SCSE1011555 #include <stdio.h> int main() { int a,b,c; printf("Enter any three numbers.n"); scanf("%d%d%d",&a,&b,&c); if(a>b && a>c) { printf("%d is greater than %d and %dn",a,b,c); if(a%2==0) { printf("%d is evenn",a); } else { printf("%d is oddn",a); } } if(b>c && b>a) { printf("%d is greater than %d and %dn",b,a,c); if(b%2==0) { printf("%d is evenn",b); } else
  • 20.
    { printf("%d is oddn",b); } } if(c>a&& c>b) { printf("%d is greater than %d and %d",c,a,b); if(c%2==0) { printf("%d is evenn",c); } else { printf("%d is oddn",c); } } if(a<b && a<c) { printf("%d is smaller than %d and %dn",a,b,c); if(a%2==0) { printf("%d is evenn",a); } else { printf("%d is oddn",a); } } if(b<c && b<c) { printf("%d is smaller than %d and %dn",b,a,c); if(a%2==0) { printf("%d is evenn",b); } else { printf("%d is oddn",b); }
  • 21.
    } if(c<b && c<a) { printf("%dis smaller than %d and %dn",c,a,b); if(c%2==0) { printf("%d is evenn",c); } else { printf("%d is oddn",c); } } return 0; } Output:
  • 22.
    Q2:Write a programto check whether input alphabet is vowel or not using if-else and switch statement. Program 2: Using If-else statement //Syed Fuzail //22SCSE1011555 #include <stdio.h> int main() { char v; printf("Enter any alphabet.n"); scanf("%c",&v); if(v=='a'||v=='e'||v=='i'||v=='o'||v=='u'||v=='A'||v=='E'||v=='I'||v=='O'|| v=='U') { printf("Entered alphabet %c is vowel.",v); } else { printf("Entered alphabet %c is consonant",v); } return 0; } Output:
  • 23.
    Using Switch Statement //SyedFuzail //22SCSE1011555 #include <stdio.h> int main() { char v; printf("Enter any alphabet.n"); scanf("%c",&v); switch(v) { case'a': printf("Vowel"); break; case'e': printf("Vowel"); break; case'i': printf("Vowel"); break; case'o': printf("Vowel"); break; case'u': printf("Vowel"); break; case'A': printf("Vowel"); break; case'E': printf("Vowel"); break; case'I': printf("Vowel"); break;
  • 24.
  • 25.
    Q3. Write aprogram to get input of two or higher digit integer number and display in reverse order. Program 3: // Syed Fuzail //22SCSE1011555 #include <stdio.h> int main() { int n, reverse = 0, remainder; printf("Enter an integer: "); scanf("%d", &n); while (n != 0) { remainder = n % 10; reverse = reverse * 10 + remainder; n /= 10; } printf("Reversed number = %d", reverse); return 0; } Output:
  • 26.
    Q4. Write aprogram that asks a number and test the number whether it is multiple of 5 or not, divisible by 7 but not by eleven. Program 4: //Syed Fuzail //22SCSE1011555 #include <stdio.h> int main() { int n; printf("Enter any number.n"); scanf("%d",&n); if(n%5==0) { printf("%d is multiple of 5. n",n); } else { printf("%d is not multiple of 5.n",n); } if((n%7==0)&& (n%11!=0)) { printf("Given Number is also divisible by 7 but not by 11."); } else { printf("Not divisible by 7 and 11"); } return 0; }
  • 27.
  • 28.
    Q5. Write aprogram to check whether the entered year is leap year or not (a year is leap if it is divisible by 4 and divisible by 100 or 400.) Program 5: //Syed Fuzail //22SCSE1011555 #include <stdio.h> int main() { int a; printf("Enter any year to check leap year or not"); scanf("%d",&a); if((a%4==0)||(a%400==0)&&(a%100==0)) { printf("n %d is a leap year",a); } else { printf("n %d is not a leap year",a); } return 0; } Output:
  • 29.
    Q6. Write aprogram to read the values of coefficients a, b and c of a quadratic equation ax2+bx+c=0 and find roots of the equation. Program 6: //Syed Fuzail //22SCSE1011555 #include <math.h> #include <stdio.h> int main() { double a, b, c, discriminant, root1, root2, realPart, imagPart; printf("Enter coefficients a, b and c: "); scanf("%lf %lf %lf", &a, &b, &c); discriminant = b * b - 4 * a * c; // condition for real and different roots if (discriminant > 0) { root1 = (-b + sqrt(discriminant)) / (2 * a); root2 = (-b - sqrt(discriminant)) / (2 * a); printf("root1 = %.2lf and root2 = %.2lf", root1, root2); } // condition for real and equal roots else if (discriminant == 0) { root1 = root2 = -b / (2 * a); printf("root1 = root2 = %.2lf;", root1); } // if roots are not real else { realPart = -b / (2 * a); imagPart = sqrt(-discriminant) / (2 * a); printf("root1 = %.2lf+%.2lfi and root2 = %.2f-%.2fi", realPart, imagPart, realPart, imagPart); }
  • 30.