Last active
June 26, 2022 13:35
-
-
Save SirmaXX/54684d705ab524ea8dd71b7426e9523b to your computer and use it in GitHub Desktop.
Mae for two loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
startTime <- Sys.time() | |
y<-c(10,8,6,4,2) | |
x<-c(5,4,3,2,1) | |
n<-length(y) | |
toplam=0 | |
for (i in 1:n) { | |
diff=y[i]-x[i] | |
toplam=toplam+diff | |
} | |
sonuc=toplam/n | |
print(sonuc) | |
endTime <- Sys.time() | |
print(endTime-startTime ) | |
#output | |
# startTime <- Sys.time() | |
# | |
#y<-c(10,8,6,4,2) | |
#x<-c(5,4,3,2,1) | |
# n<-length(y) | |
# | |
# toplam=0 | |
# for (i in 1:n) { | |
# diff=y[i]-x[i] | |
# toplam=toplam+diff | |
# } | |
# | |
# sonuc=toplam/n | |
# print(sonuc) | |
#[1] 3 | |
# | |
# endTime <- Sys.time() | |
# | |
# print(endTime-startTime ) | |
#Time difference of 0.008654833 secs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment