Created
April 13, 2019 13:56
-
-
Save winhtut/5730eb462bc866d1db2ae5f841ca5f94 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Formula | |
// | |
#include <iostream> | |
#include<stdlib.h> | |
using namespace std; | |
int main() | |
{ | |
double e = 0;//energy of the problem | |
double h = 6.6256;// plank 's constant | |
double c = 299792458;// speed of light | |
double Redwave =700; | |
double Orange = 635; | |
double Yellow = 590; | |
double Green = 560; | |
double Cyan = 520; | |
double Blue = 490; | |
double Violet = 450; | |
int color = 0; | |
while (1 < 2) { | |
cout << "Press 1 To Know Red" << endl; | |
cout << "Press 2 To Know Orange" << endl; | |
cout << "Press 3 To Know Yellow" << endl; | |
cout << "Press 4 To Know Green" << endl; | |
cout << "Press 5 To Know Cyan" << endl; | |
cout << "Press 6 To Know Blue" << endl; | |
cout << "Press 7 To Know Violet" << endl; | |
cout << "If you Want to Exit Press 9" << endl; | |
cout << "Press Now :"; | |
cin >> color; | |
switch (color) { | |
case 1: | |
e = (h * c) / Redwave; | |
cout << "The energy of Red photon is :" << e << " Joules" << endl; | |
break; | |
case 2: | |
e = (h * c) / Orange; | |
cout << "The energy of Orange photon is :" << e << " Joules" << endl; | |
break; | |
case 3: | |
e = (h * c) / Yellow; | |
cout << "The energy of Yellow photon is :" << e << " Joules" << endl; | |
break; | |
case 4: | |
e = (h * c) / Green; | |
cout << "The energy of Green photon is :" << e << " Joules" << endl; | |
break; | |
case 5: | |
e = (h * c) / Cyan; | |
cout << "The energy of Cyan photon is :" << e << " Joules" << endl; | |
break; | |
case 6: | |
e = (h * c) / Blue; | |
cout << "The energy of Blue photon is :" << e << " Joules" << endl; | |
break; | |
case 7: | |
e = (h * c) / Violet; | |
cout << "The energy of Violet photon is :" << e << " Joules" << endl; | |
break; | |
case 9: | |
exit(1); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment