def binary():
n=18
c=0
b=""
s=""
while(n>0):
b=n%2
c=n%2
if(b==1):
b="1"
elif(b==0):
b="0"
s=b+s
n=(n-c)/2
return s
binary()
print(binary())
แสดงบทความที่มีป้ายกำกับ no Lab แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ no Lab แสดงบทความทั้งหมด
วันจันทร์ที่ 28 กันยายน พ.ศ. 2558
วันพุธที่ 26 สิงหาคม พ.ศ. 2558
digital clock
int count=0 ;
int sec=0;
int min=0;
int hour=0;
void setup(){
size(300,300);
}
void draw(){
background(0,0,0);
count++;
println("count"+count);
if (count==20){
count=0;
println("sec"+sec);
sec=sec+1;
if(sec==10){
sec=0;
println("min"+min);
min=min+1;
if(min==5){
min=0;
println("hour"+hour);
hour++;
if(hour==2){
count=0 ;
sec=0;
min=0;
hour=0;
}
}
}
}
textSize(50);
text(sec,200,100);
text(min,120,100);
text(hour,40,100);
textSize(70);
text(":",180,100);
text(":",100,100);
}
สมัครสมาชิก:
บทความ (Atom)