8. # include <stdio.h> int main (void ) { printf(“Hello, Good morning. ”); } ตัวอย่างโปรแกรม โปรแกรมที่ 1 เป็นโปรแกรมสั่งพิมพ์ข้อความ Hello, Good morning.
9. โปรแกรมที่ 2 # include <stdio.h> main ( ) { float point; printf("Put your score in"); scanf("%f", &point); printf("Your score is %f point", point); } เป็นโปรแกรมรับคะแนนและเก็บค่าที่ตัวแปร point หลังจากนั้นสั่งให้มีการพิมพ์ คะแนน ออกมา
16. ตัวอย่างโปรแกรม # include <stdio.h> main ( ) { char newline; newline = ‘’; printf(“Hello, Good morning. %c”,newline); printf(“Hello, Good morning.”); }
17. ข้อมูลและตัวแปรชนิดจำนวนเต็ม จำนวนเต็มในภาษาซีสามารถใช้แทนได้ 4 รูปแบบคือ int, short, long และ unsigned สำหรับการกำหนดตัวแปรแบบ unsigned คือจำนวนเต็มที่ไม่คิดเครื่องหมาย นั้นจะต้องใช้ควบคู่กับรูปแบบข้อมูลจำนวนเต็มชนิดอื่น ๆ คือ int หรือ short หรือ long ตัวอย่างเช่น unsigned int plusnum; unsigned long width; unsigned short absno; /* absolute number */
40. คำสั่งวนรอบแบบที่ตรวจสอบเงื่อนไขทีหลัง : do while รูปแบบ do statement; while ( นิพจน์เงื่อนไข ) ; เช่น num = 2; do { num++; printf(“Now no is %d”,num); } while (num == 10)