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

Encode and Decode Strings - NeetCode.IO Solution by me + gemini pro 3.0 explained

  class Solution {         // encode: List of Strings -> String     public String encode ( List < String > strs) {         Stri...