hello everyone
Q1-see this equation
http://www.daniweb.com/forums/attachment.php?attachmentid=15688&stc=1&d=1278298959
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
http://www.daniweb.com/forums/attachment.php?attachmentid=15689&stc=1&d=1278298959
and this is the code
double param,result;
cin >> param;
result = sin(param);
cout << result;
waiting for you :)