fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. // กำหนดชื่อเดือนและจำนวนวันของแต่ละเดือน
  5. char *months[] = {
  6. "January", "February", "March", "April", "May", "June",
  7. "July", "August", "September", "October", "November", "December"
  8. };
  9.  
  10. int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  11.  
  12. // แสดงตารางเดือนและจำนวนวัน
  13. printf("Month\t\tDays\n");
  14. printf("-------------------------\n");
  15.  
  16. for (int i = 0; i < 12; i++) {
  17. printf("%-10s\t%d\n", months[i], days[i]);
  18. }
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
Month		Days
-------------------------
January   	31
February  	28
March     	31
April     	30
May       	31
June      	30
July      	31
August    	31
September 	30
October   	31
November  	30
December  	31