hello everyone

Q1-see this equation

is this the correct code for this Q1?

``````#include<iostream>
using namespace std;
int main()
{
float s=0,p;
int i,j;
float x;
cout<<"x=";
cin>>x;
for(j=1;j<=6;j++)
{
p=1;
for(i=1;i<=j;i++)
p*=x;

if(j%2==0)
s+=(-p/j);
else
s+=(p/j);
}
cout<<"ln("<<x+1<<")="<<s<<endl;
system("pause");
return 0;
}``````

***

Q2- i want to edit this code to accept one number and then show the numbaer whether is a prime or not

this is the code and i try to edit but i couldn't

this is the code

``````int num,isprime;
cout <<"Please enter a number: ";
cin >> num;
for(int i=2; i<=num;i++)
{
isprime = 1;
for(int j=2; j<=i ; j++)
{
if( i == j)
continue;
else if( i % j == 0){
isprime = 0;
}
}
if(isprime == i){
cout<<i<<"is a prime number ";
}else{
cout<<i<<"is not a prime number ";
}
}``````

****

Q3 - also i want to make sure that is the correct code for this question,plase see the picture

and this is the code

``````double param,result;
cin >> param;
result = sin(param);
cout << result;``````

waiting for you :)

Why dont you do a test run and see if its correct for your self. Use your calculator
to check if Question #1 is correct, and use the web to check if Question #2 is correct.
I can't really tell you because your code is hard to read.

hello,

the problem is i'm really poor in math so i cant check by my self and also i can't find anywebsite to help me checking the answers

umm ok, see if this is what you get.

For question what does it yield the correct answer :

#1)
ln(1 + 0) = 0
ln(1 + 1) = 0.69314718055994530941723212145818
ln(1 + 2) = 1.0986122886681096913952452369225
ln(1 + 3) = 1.3862943611198906188344642429164

For question # 2)

is any of these a prime by using your program :

2 3 5 7 11 13 17 19 23 29
31 37 41 43 47 53 59 61 67 71

the answer is all of them should be a prime. Check if you pass all of the test above.

hello,

no it's not the same answers

for Q2, the code is ask the user to input a number ant then print all the prime numbers below the user number, but i can't edit to check is this a prime number or not