> My while loop isnt looping help please!?

My while loop isnt looping help please!?

Posted at: 2014-12-18 
If you are checking that n==11, you do not have to check again for n!=11. An else automatically covers that.

I'm not sure what the rest of the code is supposed to be doing. You ask for a number of entries, but if you want "Enter your number" to be repeated that number of times then you need to put the prompt (and the cin>>) into the loop.

Perhaps you want your if / else to also be inside the loop.

void main is an error as far as I know. The main function is of type int but does not need to return a value, so you cannot do void main.

Line 21, you have a capitalized I in 'if'.

The if and else if statements beginning on line 21 are not treated as a group, to fix this, use curly braces for the if statement and the else if will automatically be paired with it.

#include

#include

using namespace std;

void main()

{

long long n;

int k,m,p=0;

cout<<"enter number of entries"<
cin>>k;

cout<<"enter your number"<
cin>>n;

while (k>0)

{

m=n%10;

n=n/10;

p=p+1;

n=m*pow(-1,p)+n;

k--;

}

cout<
If (n==11)

cout<<"this number is divisible by 11"<
else if(n!=11)

cout<<"this number is not divisible by 11"<
cin.get();

cin.get();

}