I need to include validation to only accept numbers and to only the last four odd numbers in the table. Appreciate if someone could help
Code:
#include <stdio.h>void main() {
int upper, range, i;
printf("Enter an integer to find multiplication table: ");
scanf("%d",&upper);
printf("Enter range of multiplication table: ");
scanf("%d",&range);
for(i=1;i<=range;++i) {
if(i % 2 !=0){
printf("%d x %d = %d""*""\n", upper, i, upper*i);
}
else {
printf("%d x %d = %d\n", upper, i, upper*i);
}
}
printf("\n* Indicates the Odd Numbers\n");
return 0;
}