Last active
May 11, 2020 16:16
-
-
Save bryanltobing/f19dd180bfc3ac886940599dd6e92c02 to your computer and use it in GitHub Desktop.
Mencari Energi kinetik menggunakan rumus ketetepan dan data frekuensi
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
#include <iostream> | |
#include <math.h> | |
using namespace std; | |
int main() | |
{ | |
int n, counter; | |
double penampungNilaiF[n], ek[n]; | |
double f0 = 5000; | |
cout << "Masukkan banyak n : "; | |
cin >> n; | |
for (counter = 0 ; counter < n ; counter++) { | |
cout << "Nilai f" << counter+1 << "= "; | |
cin >> penampungNilaiF[counter]; | |
if(penampungNilaiF[counter] < 0) { | |
cout << "Nilai f" << counter+1 << "= "; | |
cin >> penampungNilaiF[counter]; | |
} | |
} | |
for (counter = 0 ; counter < n ; counter++) { | |
if(penampungNilaiF[counter] < 5000) { | |
ek[counter] = 0; | |
} else { | |
ek[counter] = ((6.63*pow(10, -34) * penampungNilaiF[counter]) - (6.63*pow(10, -34) * f0)) ; | |
} | |
cout << "Nilai Ek" << counter+1 << "= " << ek[counter] << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment