Posts

Showing posts from December, 2022

Solutions for even numbered questions in C++ exercises for beginners

  solutions for even numbered questions in C++ exercises for beginners   #Q2)  we can solve this problem by using arrays but for now as a beginner we solve it  by declaring five variables to store the scores of those students. #include<iostream> using namespace std; int main(){ float num1,num2,num3,num4,num5,average; cout<<"Enter the test scores respectively : "<<endl; cin>>num1>>num2>>num3>>num4>>num5; average=(num1+num2+num3+num4+num5)/5.0; cout<<"the average of the given test score is "<<average<<endl; return 0; } #Q4) let us do it by using if..else statments  #include<iostream> using namespace std; int main(){ double  x,y,z;   cout<<"Enter the three numbers respectively "<<endl; cin>>x>>y>>z; // accepting input from user  cout<<"the numer that you entered is "<<x<<" , "<<y<<" , "<&l