LOGO
www.themegallery.com
(Main Menu)
File Edit
Search Run Compile Debug Project
Option Window Help
File

Edit
Search
Run
Debu
g
Proj
ect
Opti
on
Wind
ow
Help

Project

Directories Compiler
Variable)
Charac

Inte
Long Integer)

Flo
Char
Unsigne
dchar
Int
long

ASCII
character (128
-

Float

3.4E-38
E+38

Double

1.7E-308
E+308
C
(Variable
Declaration)
type name;
type :
name :
C

main
#include <stdio.h>
Int main () {
int num;
float y;

char n;
printf("Enter
number : ")
scanf("%d",&num);
printf("Enter
name : ");
scanf("%f",&n);
printf("Thank

num
y

n
A-Z

z
Underscore)
A-Z

a-z

-

a-
Reserved Word)
aut def floa regi
o ault t ster
retu swit
do far
rn
ch
got sho type
char
o
rt def
uni cons enu

str volat brea
uct ile
k
whi
doub
case
le
le
els
signe
if
e
d
size unsig conti
C

bath_r
oom
n-sync
108dot
s
Year#
_good
goto

-
C
(char)
(string)

char
name [n] = "str";
nam
e
n
str
char
name[5]
=
"kwan" ; name
char
year[5]
= "2549";
char

name
kwan

year
year
product_id
A01
1.

int a;
int b
int Com budget
= 30000;
int Com_budget
= 35000;
int _count = 451;
void

Sue's

MAX_ENTRY
return

double
printf

time
xyz123
C
C
-

-
b=a++;
a++
a

b=a;
a=a+1;
a
a
a

b=++a;
a

a=a+1;
b=a;
a-a

b=a--;

b=a;
a
a=a-1;

--

b=--a;
--a

a

a=a-1;
a>b a
b
>==

a >= b
a
b

<
b
<==

a<b a
a <=
x < 60 && x > 50
x
x == 10 || x == 15
x
--

-
1 . 5 + 2 - 3 -2
2 . 5 / 2 - 3.5 * 2 3
3 .8*1/3
4 . - 5 + 4 * (20 %
6)
5 . (-5 * (192 / 3)
7 .8 / 3
8 .8 % 1
9 .7 / 2
10 . 3 * 6 / 5
11 . (5 * 4 )% 3
12 . 6 * ( 9 % 4
1. 2+5
2.13+89
3.2*7-4
4.-34 % 5
5.3 * 7 – ( 6 * 5 / 4 ) + 6
6.
x = 15, y = 23
z=
3.75
6.1
x+y/z
6.2
7/2+x
6.3
15 / 2 + 4 * 5 – z
C

printf
printf
int
float

string
prinft

printf
("format",variab
format
le);
n
t
r
f
b
d
u

f
c
printf
printf("Hello Program C");
Hello
Program C
printf("Lampang kunlayanee
school");
Lampang
kunlayanee school
printf
printf("Lampang Thailand");
Lampang
Thailand

x
printf("total value = %d",x);
#include <stdio.h>
void main()
{
clrscr();
prinft('Lampang
Kunlayanee Schooln");
printf("Program Cn");
getch();
}
Lampang Kunlayanee School
Program C
scanf()
C

scanf()
scanf()

scanf("format",&
variable);
format
printf()
variable
scanf
printf
float score;
float
printf("Enter score : ");

scanf("%d",&score);
score
char answer;
char
printf("Enter Figure (Y : N)
: ")
Y
N
scanf("%c",&answer
answer
char name[10];

printf("Enter your name =
");
scanf("%s",name)
name
#include <stdio.h>
void main()
{
clrscr();
int x,y,sum;
printf("Enter The
Length is : ");
scanf ("%d",&x);
printf("Enter The
Width is : ");
scanf ("%d",&y);
sum = x*y;
printf("The area is
:%d",sum);
1.
int m = 5,n = 8;
printf("%d
%dn",m%n,n%m);
1)
3)

0 1
5 3

2)

1 0
4) 3 5
int c,k
double x,y,z;
x = 1.2;y = 2.1; z = 3.2; c = 3;
z = x + y + z;
k=z/c
printf("%f %f %f %d
%f",x,y,z,k,z/c);

1)
3.

m

n

include <stdio.h>
void main()
{
clrscr();
int m,n;
printf("Enter 2 integers > ");
scanf("%d %d",&m, &n);
m = m+5;
n = 3*n;
printf("m = %dnn= %dn",m,n);
4.
first,second
include <stdio.h>
void main()
{
clrscr();
int ……………… , ………... ,
………………;
printf("Enter
………………………… ");
scanf("%d ",&………);
printf("Enter
………………………… ");
scanf("%d ",&………);
printf("Enter

third
5.

a

include <stdio.h>
void main()
{
clrscr();
int ….. , …….;
printf("Enter
………………………… ");
scanf("%d ",&………);
printf("Enter
………………………… ");
scanf("%d ",&………);
printf(“a+b,%d ",a+b);

b
6.

radius)
area)
circumference)
area = pi * radius * radius
circumference = 2 * pi *
radius
pi


F)
C)
C = (F-32)/1.8


Y

X

Y=



name)
birth year)
LOGO
www.themegallery.com

ภาษาซีพื้นฐาน