ตัวอย่างโค้ดโปรแกรมที่สร้างขึ้นด้วยภาษาซี แสดงตัวเลขซึ่งเป็นรูป \ (backslash) เรียงจาก 1 – 9 โดยการใช้ลูป for
ตัวอย่าง Flowchart

ตัวอย่างโค้ด
/***************************************************
* Author : CS Developers
* Author URI: https://www.comscidev.com
* Facebook : https://www.facebook.com/CSDevelopers
***************************************************/
#include <stdio.h>
int main()
{
int loop = 9;
int i;
int sloop;
for(i = 1; i <= loop; i++){
for(sloop = 1; sloop < i; sloop++){
printf(" ");
}
printf("%d\n", i);
}
return 0;
}
อธิบายเพิ่มเติม
สามารถแสดงตัวเลขที่มากขึ้น โดยเพิ่มค่าให้กับตัวแปร loop = 9 เป็นตัวเลขที่ต้องการได้
ผลลัพธ์
