This program is suposed to verify that the user input a integer. Give back an error if the datatype is incorect or if the input is empty. But only one time. I want to transform this program to keep asking the user until the answer is good.Here its a "single-use" programs , but i want it to do it with a while but its infinite.
#include <stdio.h>
int main()
{
int num;
char term;
if(scanf("%d%c", &num, &term) != 2 || term != '\n')
{
printf("failure\n");
}
else
{
printf("valid integer followed by enter key\n");
}
return 0;
}