Pages

Friday, March 21, 2025

calculate sum of total of 3 subjects in C++

 #include<iostream>

#include<iomanip>
using namespace std;

int main() {
    int science;
    int english;
    int math;

    cout<<"enter science marks: ";
    cin>>science;

    cout<<"enter english marks: ";
    cin>>english;

    cout<<"enter math marks: ";
    cin>>math;

    int avg = (science+science+math)/3;

    cout<<"avg = "<<avg<<endl;

    return 0;

}

No comments:

Post a Comment

3917. Count Indices With Opposite Parity (Brute Force) O(n2) + Optimized Solution O(n) + tips LEETCODE WEEKLY 500

  class Solution {     public int [] countOppositeParity ( int [] nums ) {          // approach 1 - checks every pair         int n = n...