Skip to content

Instantly share code, notes, and snippets.

@fozoglu
Last active January 30, 2017 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save fozoglu/68fee0928354b32d5c03284746ff1c1b to your computer and use it in GitHub Desktop.
Save fozoglu/68fee0928354b32d5c03284746ff1c1b to your computer and use it in GitHub Desktop.
YGS - LYS için net hesabı
import UIKit
func calculateNet(correct:Int = 0 , wrong:Int = 0 , count:Int = 0) -> (Float) {
var result : Float = 0
if (correct <= count && correct >= 0) && (wrong <= count && wrong >= 0) {
if (correct + wrong <= count){
result = Float(correct) - Float(wrong)/4
print("Net : \(result)")
}
}
return result
}
var test : Float = calculateNet(correct: 0, wrong: 10, count: 20)
@salihyalcin
Copy link

Android versiyonu şu şekildedir :)


    public Float calculateNet(int correct, int wrong, int count){
        float result = 0;

        if ((correct <= count && correct >= 0) && (wrong <= count && wrong >= 0) ){

            if (correct + wrong <= count){

                result  = (float)correct - (float)wrong /4;

                Toast.makeText(MainActivity.this,"Sonuç-- " + result ,Toast.LENGTH_SHORT ).show();
                
            }

        }

        return result;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment