aboutsummaryrefslogtreecommitdiff
path: root/tests/functional/30_while_if_test1.sy
blob: 2d2b9fb6c1ffc96c48ace61af86b1f3d25a8d978 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// test while-if
int whileIf() {
  int a;
  a = 0;
  int b;
  b = 0;
  while (a < 100) {
    if (a == 5) {
      b = 25;
    }
    else if (a == 10) {
      b = 42;  
    }
    else {
      b = a * 2;
    }
    a = a + 1;
  }
  return (b);
}


int main(){
  return (whileIf());
}