A for loop is like a while loop, note the components below

for (int m = 0; m < 4; m++ )
int m = 0;
while ( m < 4 )
{
m++ }

In your code you have the initializer int m = 0
You have the comparison, but no definition for <i>
and you really should have parenthesis around the (i%2)==0
Finally your other problem m*m=i I think you may have
meant m*=i. You are doing an assignment m*m is not an assignment!

5 * 5 = i
---------------
5 * 5 = 0 /// 25 = 0 // = false
5 * 5 = 1;// 25 = 1 // false
5 * 5 = 2;// 25 = 2 // false
5 * 5 = 3//25 = 3 //false
// so on until i = 25, then it would be true, but has no effect on the
loop

Did that make sense? Obviously m*m =i , is not what you
want to do. I think you are looking for is what wildgoose posted.

if(N<4&&(N%2)==1)
{
cout<<"The program can not be executed "<<endl;
}
else(N>4&&(N%2)==0);
{
result=N*N;
cout<<"Multiplication of all positive even numbers which are greater than N: "<<result<<endl;
}

What i am trying to achive is when i enter the 4 numbers, all the positive even numbers greater 4 entered by a user should be multiplied by each other and say if only one positive even number is been entered by the user then that should multiplied by 1.

And if the user does not enter any prositive even number then the program should give and error.

if(N<4&&(N%2)==1)
{
cout<<"The program can not be executed "<<endl;
}
else(N>4&&(N%2)==0);
{
result=N*N;
cout<<"Multiplication of all positive even numbers which are greater than N: "<<result<<endl;
}

What i am trying to achive is when i enter the 4 numbers, all the positive even numbers greater 4 entered by a user should be multiplied by each other and say if only one positive even number is been entered by the user then that should multiplied by 1.

And if the user does not enter any prositive even number then the program should give and error.

{
nProduct = 1;
for (int i = 0; i < 4; i++)
{
if ((N > 4) && !(N & 1))
nProduct = nProduct * N;
cout<<"Multiplication of all positive even numbers which are greater than N: "<<nProduct<<endl;
}
}
if (1 ==nProduct)
{
cout<<"The program can not be executed "<<endl;
}
}

This iis the code i have written and even after what you have given i am unable to get my outcome.

hey the correct question is :::: multiplication of all the positive even numbers which are greater than N. if 1 even number greater than N is entered from the keyboard the entered number should be multiplied by 1. if no even number greater than N are entered, the program should display an approriate message.

If I'm understanding your problem correctly, then it seems to me like you want the program to look similar to the following outline:

#include <iostream>
using namespace std;
int main(void)
{
int nUserNum;
//set the next variable equal to 1 so that if the user enters
//only one applicable number, it is multiplied by 1
int nTotalNum=1;
for(int i=0;i<4;i++)
{
//ask user to enter their number and store it in nUserNum
if(nUserNum > 4 && nUserNum % 2 == 0)
{
//multiply nTotalNum by nUserNum and store in
//nTotalNum
}
//this next part insures that the user receives an error
//message if they don't enter an applicable number
if(i == 3 && nTotalNum == 1)
{
//give user error message
}
}
//Display the user's total using the nTotalNum variable
return 0;
}

Hopefully that sets you guys on the correct track.

hi
this is one of my assignment that I have to do. it is a triangle calculator. everything well with it but it just the calculation. when I run it, ...

Hello everyone hope you are doing well, i was busy these days i was having problem with the police in my country, they catch me smoking weed and now i ...