Created
April 10, 2017 02:42
-
-
Save hu2di/ace7b05aa29649c9e14835d762b9a35b to your computer and use it in GitHub Desktop.
C-sharp: Convert
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
int n; | |
n = int.Parse(Console.ReadLine()); | |
double sum = 0.0; | |
for (int iCount = 1; iCount <= n; iCount++) | |
{ | |
sum = sum + 1 / iCount; | |
} | |
Console.WriteLine("Ket qua: {0}", sum); | |
int n; | |
n = int.Parse(Console.ReadLine()); | |
double sum = 0.0; | |
for (int iCount = 1; iCount <= n; iCount++) | |
{ | |
sum = sum + 1 / Convert.ToDouble(iCount); | |
} | |
Console.WriteLine("Ket qua: {0}", sum); | |
int n; | |
n = int.Parse(Console.ReadLine()); | |
double sum = 0.0; | |
for (int iCount = 1; iCount <= n; iCount++) | |
{ | |
sum = sum + 1.0 / iCount; | |
} | |
Console.WriteLine("Ket qua: {0}", sum); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment