Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Session 3

import Foundation
import Glibc
/*
let numberOfBoys: Int = 20
let numberOfGirls: Int = 60
let numberOfStudents: Int = numberOfBoys + numberOfGirls
var percentageOfBoys: Int =  ( numberOfBoys * 100 / numberOfStudents  ) 
var percentageOfGirls: Int = ( numberOfGirls * 100 / numberOfStudents )
print("The percentage of boys in the class = \(percentageOfBoys) \nThe percentage of girls in the class = \(percentageOfGirls)")
*/
/*
//Another Way
let numberOfBoys: Int = 20
let numberOfGirls: Int = 60
let numberOfStudents: Int = numberOfBoys + numberOfGirls
var percentageOfBoys =  Double ( numberOfBoys )  / Double( numberOfStudents ) * 100 
var percentageOfGirls = Double ( numberOfGirls )  / Double( numberOfStudents ) * 100
print("The percentage of boys in the class = \(percentageOfBoys) \nThe percentage of girls in the class = \(percentageOfGirls)")
*/

/*
//test
var a = 6
var b = 6
if (a > b) {
    print("a > b")
} else if (a < b) {
    print("a < b")
}else{
    print("a = b")
}
*/
/*
var age: Int = 19
var money: Int = 25000

if age >= 18 {
    if money >= 20000 {
       print("Getting a new car, baby!")
    }else{
       print("Sorry, you don't have enough money.")
    }
}else{
    print("Sorry, you're not old enough.")
}
 */
/* 
var a: Int = 6
var b: Int = 7
if a > b {
   print("The largest is a = \(a)")
}else if b > a {
   print("The largest is b = \(b)")
}else{
    print("a = b")
}

if a % 2 == 0 {
    print("a = \(a) is even ")
}else{
    print("a = \(a) is odd ")
}
*/

/*
var a: Int = 8
var b: Int = 2
if a % b == 0 {
   print("divisible")   
} else {
   print("not divisible")
}
*/












 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

    












Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.