Question: #include using namespace std; int main() { int n;//to store input value //taking user input cout < >n;//reading number int sum=0;//to store sum from 1

#include
using namespace std;
int main()
{
int n;//to store input value
//taking user input
cout<<"Enter a number:";
cin>>n;//reading number
int sum=0;//to store sum from 1 to n
for(int i=1;i<=n;i++)
sum+=i;//finding sum
//printing total sum
cout<<"Total from 1 to "<
//printing total is even or odd
if(sum%2==0)
cout<<"Total is even ";
else
cout<<"Total is odd ";
//checking total is prime or not
for(int i=2;i
if(sum%i==0)//means total is not prime
{
cout<<"Total is not a prime number ";
return 0;
}
//if total is prime
cout<<"Total is a prime number ";
return 0;
}
i would i explain this in word to my professor he is asking how many fuction this code as and how did i find out if the number is even or odd
this is a C++ class language C++

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!