how to get integer input in c code example
Example 1: how to make sure input is integer c
#include <string.h>
bool isNumber(string s)
{
for (int i = 0; i < strlen(s); i++)
if (isdigit(s[i]) == false)
return false;
return true;
}
Example 2: get int from user c
#include <stdio.h>
int n;
scanf("%d",&n);