#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;}
Standard input is empty
#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; }
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!