You are on page 1of 6

c  



.
, , ,
,   
 

 


  .
, , .

G
     
[    
r  

     .
, 783-850 [] (Algorithmi)
.

( )

1:

2:

3:
r .
( )
( ) .
.
, 
 .
  .
   
, .

.

#include <stdio.h>
main(){
int a, b;
scanf("%d%d", &a, &b);
printf("%d", a+b);

: ABR0000
a, b .
.

return 0;
}

;  
a, b
.
 
.
 
;  
12
 
3

r a, b , main
. stdio.h scanf(), printf()
. return, int C
.
  
, .
< > < >([])
{
[ ;]
}
:

int gcd(int a, int b){


int i=a, j=b;
while(i!=j){
if(i>j) i-=j;
else j-=i;
}
return i;
}
void main(){
int m=10, n=25;
int hieh=gcd(m, n);
}
:

r gcd a, b ()
. m, n 10, 25 a, b
. a, b
m, n .
void swap(int *x, int *y){
int temp;
temp=*x;
*x=*y;
*y=temp;
}
void main(){
int m=10, n=25;
int hieh=swap(&m, &n);
}
:

swap() main()
m, n .
w


  !" # 
$ 

0 1 ;
0,1,2,3,.7 ;
0,1,2,3,.9,A,B,C,D,E,F 16

.

[%  . 8 .
&'() .
] 8bit = 1byte
] 1024byte = 1Kbyte
] 1024Kbyte = 1Mbyte
] 1024Mbyte = 1Gbyte

1

0
0

1
. 1-
.

  *  

.
.
#include <stdio.h>
void main(){
char i;
for(i=0;i<=255;i=i+1)
printf(%c %d , i, i);
}
: ASCII
ASCII (American Standard Code for
Information Interchange) 256 .
256 printf()
. 260 .
6
256 , .
  + %        
. r .
.
, ,
.
.



.

.


,

.

,  ;   $ $  
. C
.
:
-+##   ../-$    /0-.  /10-% /12
, .

 3  ..
,
.
: , , ,
..
struct student {
char name[20];
int age;
} a[40];
: .
4  5#$
.

Stack overflow .
.
#include <stdio.h>
void Hanoi(int a, int b, int c, int n){
if(n==1){
printf("%d -> %d", a, c);
}
else{
Hanoi(a, c, b, n-1);
printf("%d -> %d", a, c);
Hanoi(b, a, c, n-1);
}
}
void main(){ int a=1, b=2, c=3, n;
scanf("%d", &n);
Hanoi(a, b, c, n);
}
:
[     
.
.
. ,
.

.

.
.

You might also like