source: CIVL/examples/experimental/problem1.c@ 0d6c665

1.23 2.0 main test-branch
Last change on this file since 0d6c665 was da09421, checked in by Yihao Yan <yihaoyan1@…>, 10 years ago

verifyThis problem1

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@2898 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 537 bytes
Line 
1#include <civlc.cvh>
2#include <stdio.h>
3
4$input int A_BOUND;
5$input int B_BOUND;
6$input int A;
7$input int B;
8$assume (A>0 && B>0 && A<A_BOUND && B<B_BOUND);
9/*
10command: civl verify -inputA_BOUND=4 -inputB_BOUND=6 problem1.c
11*/
12int myGCD(int a, int b){
13 while(a != b){
14 if(a > b)
15 a = a-b;
16 if(b > a)
17 b = b-a;
18 }
19 return a;
20}
21
22void main(){
23 int result1 = myGCD(A, B);
24 int minAB = A < B ? A : B;
25 $assert($forall {i = (result1+1) .. (minAB)} (A%i != 0 || B%i != 0));
26 $assert( A%result1 == 0 && B%result1 == 0);
27}
Note: See TracBrowser for help on using the repository browser.