fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int n, i;
  5.  
  6. // รับค่าจำนวนรอบที่ต้องการจากผู้ใช้
  7. printf("Input number of terms: ");
  8. scanf("%d", &n);
  9.  
  10. // ใช้ลูป for เพื่อวนซ้ำและคำนวณค่ากำลังสามของแต่ละจำนวน
  11. for (i = 1; i <= n; i++) {
  12. printf("Number is: %d and cube of the %d is: %d\n", i, i, i * i * i);
  13. }
  14.  
  15. return 0;
  16. }
  17.  
  18.  
Success #stdin #stdout 0.03s 25952KB
stdin
#include <stdio.h>

int main() {
    int n, i;

    // รับค่าจำนวนรอบที่ต้องการจากผู้ใช้
    printf("Input number of terms: ");
    scanf("%d", &n);

    // ใช้ลูป for เพื่อวนซ้ำและคำนวณค่ากำลังสามของแต่ละจำนวน
    for (i = 1; i <= n; i++) {
        printf("Number is: %d and cube of the %d is: %d\n", i, i, i * i * i);
    }

    return 0;
}
stdout
#include <stdio.h>

int main() {
    int n, i;

    // รับค่าจำนวนรอบที่ต้องการจากผู้ใช้
    printf("Input number of terms: ");
    scanf("%d", &n);

    // ใช้ลูป for เพื่อวนซ้ำและคำนวณค่ากำลังสามของแต่ละจำนวน
    for (i = 1; i <= n; i++) {
        printf("Number is: %d and cube of the %d is: %d\n", i, i, i * i * i);
    }

    return 0;
}