Ubaid Assignmnent Itp Class
Ubaid Assignmnent Itp Class
QUESTION NO 01
Write a C++ program to find out 2nd
largest number from an array.
INPUT:
int main()
{
int list[10], temp;
return 0;
}
OUTPUT:
QUESTION NO 02
Write a C++ program to separate
even and odd numbers in an array of
integers put all even numbers first and
then odd numbers.
INPUT:
#include<iostream>
using namespace std;
int main()
{
int list[10], temp;
return 0;
}
OUTPUT:
QUESTION NO 03
Write a program to sort array of 0’s, 1’s and
2’s. Final array put all 0’s than all 1’s and all
2’s at last.
INPUT:
#include<iostream>
using namespace std;
int main()
{
int list[10] = { 0,1,2,0,1,2,0,1,2,0 };
int temp;
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10 - i - 1; j++)
{
if (list[j] > list[j + 1])
{
temp = list[j];
list[j] = list[j + 1];
list[j + 1] = temp;
}
}
}
return 0;
}
OUTPUT:
QUESTION NO 04
Write a C++ program to find 3rd
smallest value from an array having 10
elements.
INPUT:
#include<iostream>
using namespace std;
int main()
{
int list[10], temp;
return 0;
}
OUTPUT: