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: