Katikilo Soln
Katikilo Soln
Question: 1. Write a program to accept the total scores for students in subjects CS 8204 and
CS 8200. The program should process data for 510 students, determine the highest score,
#include <iostream>
int main() {
int scores[numStudents];
int highestScore = 0;
cout << "Enter the scores for " << numStudents << " students:\n";
highestScore = scores[i];
cout << "The highest score is: " << highestScore << endl;
return 0;
Question: 2. Develop a program that converts between kilometers and meters based on the
user's choice. Include a main() function and two helper functions: kilometerToMeter()
program should display options to the user, accept the necessary input, and show the output
accordingly.
#include <iostream>
cout << kilometers << " kilometers = " << kilometers * 1000 << " meters\n";
cout << meters << " meters = " << meters / 1000 << " kilometers\n";
int main() {
int choice;
double value;
kilometers\n";
if (choice == 1) {
kilometerToMeter(value);
} else if (choice == 2) {
meterToKilometer(value);
} else {
return 0;
Question: 3. Create a program that prompts the user to input an integer and calculates its
factorial.
#include <iostream>
int main() {
int number;
if (number < 0) {
} else {
cout << "Factorial of " << number << " is: " << factorial << endl;
return 0;
Question: 4. Write a program to extract and display the initials of a user's first name, middle
#include <iostream>
#include <string>
int main() {
Question: 5. Write a program to display the following 3x3 matrix and determine the greatest
6 9 7
8 5 12
4 6 16
#include <iostream>
int main() {
int matrix[3][3] = {
{6, 9, 7},
{8, 5, 12},
{4, 6, 16}
};
greatest = matrix[i][j];
}
cout << endl;
cout << "The greatest number in the matrix is: " << greatest << endl;
return 0;