Question: I keep getting expected declaration or statement at end ofinput. #include #include int main() { int x,y; printf (enter 2 numbers:); //takes input of starting

I keep getting expected declaration or statement at end ofinput.

#include
#include

int main()
{
int x,y;

printf ("enter 2 numbers:");

//takes input of starting number from user

printf ("enter starting number:");

scanf("%d", &x);

//takes input of ending user

printf ("enter ending number: ");

scanf ("%d",&y);

//loop iterates till x is less than or equalto y

while(x<=y)
{
//printing current number
printf ("current number is:%d",x);

//condition to check if x iseven

if (x%2==0)
{
//printing current numberis even

printf ("currentnumber is even");

//multiplying thenumber with 3 and print result

printf("%",x*3);
}

else {// if x is odd

//printing currentnumber is odd

printf ("the currentnumber is odd");

//adding 10 to thenumber and print the result

printf("%d",x+10);}

//incrementing the x value
x++;

return 0;

}

Step by Step Solution

3.22 Rating (143 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Answer Answer In the given code return 0 is specified inside the while loop and closing bracket for ... View full answer

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 Programming Questions!