Hello, I am having issues with this program I created, the goal of this program is for the user to input numbers and it will display the sum of the numbers. If a user enters in any letters then it will give the message "Please enter only numbers.". The problem I have is if you enter in numbers it still says "Please enter only numbers.". Any help is truly appreciated.
Code:
#include<stdio.h>
#include<ctype.h>
int main()
{
int num1, num2, sum;
printf("Please enter numbers for me to add.\n");
scanf("%d", &num1);
scanf("%d", &num2);
sum = (num1 + num2);
if (isdigit(num1)==1 && (num2)==1 )
printf("%d + %d = %d\n", num1, num2, sum);
else
printf("Please enter only numbers.\n");
return 0;
}