0% found this document useful (0 votes)
26 views

Data Structure Lab

The document contains the submission details for a data structures lab assignment submitted by student Nafiza Humauara Hasan Neha to their professor Md. Mahbub-Or-Rashid at the Department of Computer Science and Engineering at Bangladesh University of Business and Technology. The code finds the location and value of the largest element in an array of integers and solves a quadratic equation by calculating the discriminant.

Uploaded by

Syed Irfan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Data Structure Lab

The document contains the submission details for a data structures lab assignment submitted by student Nafiza Humauara Hasan Neha to their professor Md. Mahbub-Or-Rashid at the Department of Computer Science and Engineering at Bangladesh University of Business and Technology. The code finds the location and value of the largest element in an array of integers and solves a quadratic equation by calculating the discriminant.

Uploaded by

Syed Irfan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Bangladesh University of Business and Technology

Dept. name : Computer Science and Engineering


Course name : Data Structure Lab

Course code : CSE 232

Submitted By : Nafiza Humauara Hasan Neha


22234103306

Submitted To : Md. Mahbub-Or-Rashid


Assistant professor,
Dept. of Computer Science and Engineering

Submission Date : 13-07-2023


Name: Find the location LOC and the value MAX of the largest element

of data

Code:

#include <iostream>

using namespace std;

int main()

int data[]={20,30,40,11,110,50,60,70,80,100};

int size=sizeof(data)/sizeof(data[0]);

int Max= data[0];

int loc=0;

for(int i=1;i<size;i++)

if(data[i]>Max)

Max=data[i];

loc=i;

cout<<"The largest value of array is :"<<Max<<endl;

cout<<"The location of the largest value is :"<<loc<<endl;

return 0;
}

Output:

Name: The Solution of Quadratic Equation

Code:

#include <iostream>

#include <cmath>

using namespace std;

int main()

int a, b, c, D;

float X, X1, X2;

cout << "Enter the Value of a, b, and c: " << endl;

cin >> a >> b >> c;


D = b * b - 4 * a * c;

if (D > 0)

X1 = (-b + sqrt(D)) / (2 * a);

X2 = (-b - sqrt(D)) / (2 * a);

cout << "X1: " << X1 << ", X2: " << X2 << endl;

else if (D == 0)

X = -b / (2 * a);

cout << "Unique solution: " << X << endl;

else

cout << "No solution" << endl;

return 0;

}
Output:

You might also like