wap to accept a positive number from user and test accepted number is multiple of 20 or…
- User
wap to accept a positive number from user and test accepted number is multiple of 20 or not in c
Assistant
Certainly! Below is a simple C program that accepts a positive number from the user and checks whether the number is a multiple of 20 or not.
#include <stdio.h> int main() { int number; // Prompt the user to enter a positive number printf("Enter a positive number: "); scanf("%d", &number); // Check if the number is positive if (number <= 0) { printf("Please enter a positive number.\n"); } else { // Check if the number is a multiple of 20 if (number % 20 == 0) { printf("%d is a multiple of 20.\n", number); } else { printf("%d is not a multiple of 20.\n", number); } } return 0; }
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.