This is what the question is asking:
Write a program to get the user to enter a positive number. Validate the input so any negative or zero number entered is rejected and the user is to re-enter the number.
and this is what i have done
#include<stdio.h>
int main (void)
{
int x;
do {
printf("incorrect value\n");
printf("enter a positive number\n");
scanf("%d",&x);
}
while (x != 0 && x>0);
getchar ();
getchar();
return 0;
}
This works pretty fine. Is there any way that I can include the incorrect value printline without having it to appear the first time?
I know that the problem can easily be solved by ommiting that line