fork download
  1. #include <stdio.h>
  2.  
  3. void drawLine(int x1, int y1, int x2, int y2) {
  4. // Simple ASCII representation of a line
  5. printf("Drawing a line from (%d, %d) to (%d, %d):\n", x1, y1, x2, y2);
  6. printf(" ^ y\n");
  7. printf(" |\n");
  8. printf(" +");
  9. for (int i = 0; i < x2; i++) printf("-");
  10. printf("> x\n");
  11. }
  12.  
  13. int main() {
  14. printf("Prabesh Ghimire\n");
  15. drawLine(100, 100, 200, 200);
  16. return 0;
  17. }
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
Prabesh Ghimire
Drawing a line from (100, 100) to (200, 200):
  ^ y
  |
  +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> x