0% found this document useful (0 votes)
9 views8 pages

Assignment CA

The document contains the code submissions and questions for a student's computer application assignment. It includes code to calculate the average marks of 10 students and number of passed students, as well as code to determine a grade based on written and practical exam scores.

Uploaded by

kavindupunsara02
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views8 pages

Assignment CA

The document contains the code submissions and questions for a student's computer application assignment. It includes code to calculate the average marks of 10 students and number of passed students, as well as code to determine a grade based on written and practical exam scores.

Uploaded by

kavindupunsara02
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Assignment No: 01

• Student Name : K.K Punsara


• Registration No : 21GES1475
• Subject Name : Computer Application
• Subject Code : FC12323
• Date Of Submission : 2024/05/15
QUESTION 1.a
#include <iostream>
using namespace std;
int main()
{
int intMarks[10];
float fltSumOfMarks=0;
float fltAverageMarks;
cout<<"Enter marks of ten students:"<<endl;
for (int i=0;i<10;++i)
{
cin>>intMarks[i];
fltSumOfMarks+=intMarks[i];
}
fltAverageMarks=fltSumOfMarks/10;
cout<<"Average marks of the class:"<<fltAverageMarks<<endl;
return 0;
}
QUESTION 1.b
#include <iostream>
using namespace std;
int main()
{
int intMarks[10];
float fltSumOfMarks=0;
float fltAverageMarks;
cout<<"Enter marks of ten students:"<<endl;
for (int i=0;i<10;++i)
{
cin>>intMarks[i];
fltSumOfMarks+=intMarks[i];
}
fltAverageMarks=fltSumOfMarks/10;
cout<<"Average marks of the class:"<<fltAverageMarks<<endl;

int intPassedStudents=0;
for (int i=0;i<10;++i)
{
if(intMarks[i]>=50)
{
intPassedStudents++;
}
}
cout<<intPassedStudents<<" "<<"students passed the test"<<endl;
return 0;
}
QUESTION 2
#include <iostream>

using namespace std;

int main()

int intWrittenMark,intPracticalMark;

float fltAverageMark;

char chrGrade;

cout<<"Enter written exam mark(out of 100):";

cin>>intWrittenMark;

cout<<"\nEnter practical exam mark(out of 100):";

cin>>intPracticalMark;

if(intWrittenMark>=20 && intPracticalMark>=20)

fltAverageMark=(intWrittenMark+intPracticalMark)/2.00;

if(fltAverageMark>=80)

chrGrade='A';

else if(fltAverageMark>=60)

chrGrade='B';

else if(fltAverageMark>=40)

chrGrade='C';

else if(fltAverageMark>=25)

chrGrade='D';

else if(fltAverageMark>=60)

chrGrade='B';

else

chrGrade='E';

cout<<"\nYour grade:"<<chrGrade<<endl;

else
{

cout<<"\nBoth components of the assessment must be passed with a minimum mark of


20%"<<endl;

return 0;

Example 1

Example 2
Example 3

You might also like