Percentage Calculation – CSKC
Sign In

Search

Code Learning #CPP#7595    siteicon   siteicon  

Percentage Calculation

Source Code

TC++ #7595

Source Code

×

Ask AI About This Code

Default Prompt that is passed along with the code is given below, You can write your own prompt if you so desire.



×

Test CPP

Code Understanding

This program calculates the percentage of marks obtained in three subjects.
• #include allows input and output commands.
• float sub1, sub2, sub3, marks, perc; declares variables for marks and percentage.
• cin >> sub1 >> sub2 >> sub3; takes marks of three subjects from the user.
• marks = sub1 + sub2 + sub3; adds all marks.
• perc = (marks / 300) * 100; calculates percentage (assuming each subject is out of 100).
• cout << … displays the percentage on the screen.
• return 0; ends the program.


Share

Created: 1-Mar-2026 16:02 | Updated: 2-Sep-2026 16:23|