fork download
  1. #include <stdio.h>
  2. int main() {
  3. int n, i;
  4. printf("Enter a number: ");
  5. scanf("%d", &n);
  6.  
  7. for(i = 1; i <= 12; i++) {
  8. if(n > 0) {
  9. printf("%d x %d = %d\n", n, i, n * i);
  10. } else {
  11. printf("Error: number must be positive.\n");
  12. break;
  13. }
  14. }
  15. return 0;
  16. }
Success #stdin #stdout 0.03s 25932KB
stdin
Standard input is empty
stdout
#include <stdio.h>
int main() {
    int n, i;
    printf("Enter a number: ");
    scanf("%d", &n);

    for(i = 1; i <= 12; i++) {
        if(n > 0) {
            printf("%d x %d = %d\n", n, i, n * i);
        } else {
            printf("Error: number must be positive.\n");
            break;
        }
    }
    return 0;
}