วันศุกร์ที่ 11 กันยายน พ.ศ. 2558

LAB 4 Fine sum of 1 to N

void setup(){
  size(600,300);
  background(0);
  //set base value of variable
  //N is real number
  //sum is sum of count to N
  //count is value for check rule
  int count=0;
  int sum=0;
  int N=100;
  textSize(30);
  text("Sum of  "+count,200,100);
  text(" to " +N,350,100);
 
  while(count<=N){
    sum=sum+count;
    count++;
  }

  text("Sum is  "+sum,200,200);
}
 

ไม่มีความคิดเห็น:

แสดงความคิดเห็น