Professional Documents
Culture Documents
, .................................................................................. 2
. ............................................................................................................................................................... 3
........................................................................................................................ 4
, ...................................................................................................................... 5
.................................................................................................................................................................... 6
.......................................................................................................................................................................... 7
2:
www.rajak.rs
.
, ,
.
. ,
stdio.h conio.h
#include<stdio.h>
#include<conio.h>
,
.
, :
= 3
= 2
+ = 5
.
(
,
, : http://goo.gl/pqK0I ).
.
,
.
:
, ,
,
#include<stdio.h>
#include<conio.h>
void main(void)
www.rajak.rs
{
int a , b , c ;
: int a , b , c ;
.
, .
() . :
1.
2.
( ). C-
:
:
int
long (int)
short (int)
unsigned (int)
char
2 bajta
4 bajta
-2147483648 2147483647
-32768 32767
0 65 535
0 255
2 bajta
2 bajta
1 bajt
-2147483648 2147483647
:
float
Double
4 bajta
8 bajta
, int ,
.
int .
2 = 2*8 216 -1 = 32 767 , 1
0.
, .
:
printf("Unesite prvi broj a :");
scanf("%d",&a);
www.rajak.rs
-
, :
SCANF
:
T
%d
%i
%l
%u
%f
%e
%lf
%s
%c
T
Int
Int
Long
Unsigned
Float (
)
Float (
)
Double
String
Char
(
)
:
scanf(%d.
.
.
& (
.
)
.
,
scanf(%d,&a);
.
www.rajak.rs
.,
printf j
,
.
, printf
.
,
:
:
printf("Unesite prvi broj a :"
:");
scanf("%d",&a);
printf("\nUnesite
nUnesite drugi broj b:"
b:");
scnaf("%d",&b);
()
(
:
:
\n
\t
\r
\b
\a
...
aa
.
\n
,
.
c = a + b;
..
,
.
www.rajak.rs
5 :
1.
2.
3.
4.
5.
1.
)
)
)
2.
3 :
)
()
)
)
()
:
2.232 2.23 * 10 ^2 = 223
-0.413 -0.41 * 10 ^3 = -410
3.
, 2 . ,
.
:
, > ,4
4.
.
:
:
5.
, , .
#define . .
, ,
. , .
, ,
.
:
10 :
1.
( )
2.
( , )
3.
.
:
www.rajak.rs
int PODATAK;
PODATAK = 10;
.
scanf()
.
, .
.
,
. :
, .
( )
, :
1.
+
*
/
%
2.
<
<=
>
>=
==
!=
3.
!
&&
||
4.
5.
.( )
6.
sizeof
7.
www.rajak.rs
)
=.
: Int = 10;
)
=+2;
= -2 ;
=*2;
= / 2;
+= 2;
-= 2;
*= 2;
/= 2;
.
.
8.
int i = 2;
i++;
: i=3;
)
int i = 2;
i--;
: i=2;
.
.
9.
COMMA
, .
10.
CAST
. .
:
int n;
(char)n;
11.
12.
13.
, , .
. .
:
. ?
printf().
,
:
. ..
www.rajak.rs
%d ( ) int (
), .
getch(), , .
:
#include<stdio.h>
#include<conio.h>
int main()
{
int a ,b , c;
printf("Unesite a :");
scanf("%d",&a);
printf("Unesite b :");
scanf("%d",&b);
c = a + b;
printf("\nZbir vasa dva broja je: %d",c);
getch();
return 0;
}
www.rajak.rs