explain method of validation in c8e7

This commit is contained in:
Akbar Rahman 2023-10-06 13:28:11 +01:00
parent 397409d0ad
commit 2d6791220f
Signed by: alvierahman90
GPG Key ID: 20609519444A1269

View File

@ -7,7 +7,7 @@ int main() {
printf("Enter radius: "); printf("Enter radius: ");
rc = scanf("%f", &radius); rc = scanf("%f", &radius);
// scanf returns number of scanned items // scanf returns number of scanned items. If input is invalid then 0 values will have been scanned.
if (rc != 1) { if (rc != 1) {
printf("Please enter an positive real integer or decimal\n"); printf("Please enter an positive real integer or decimal\n");
return 1; return 1;
@ -15,7 +15,7 @@ int main() {
printf("Enter height: "); printf("Enter height: ");
rc = scanf("%f", &height); rc = scanf("%f", &height);
// scanf returns number of scanned items // scanf returns number of scanned items. If input is invalid then 0 values will have been scanned.
if (rc != 1) { if (rc != 1) {
printf("Please enter an positive real integer or decimal\n"); printf("Please enter an positive real integer or decimal\n");
return 1; return 1;