File tree Expand file tree Collapse file tree 1 file changed +14
-12
lines changed
lesson_07/conditionals/src Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -48,27 +48,27 @@ export function compareStrings(a: string, b: string): number {
48
48
*/
49
49
export function convertGpaToLetterGrade ( gpa : number ) : string {
50
50
51
- if ( gpa >= 97 ) {
51
+ if ( gpa >= 4.0 ) {
52
52
return "A+"
53
- } else if ( gpa >= 93 ) {
53
+ } else if ( gpa >= 4.0 ) {
54
54
return "A"
55
- } else if ( gpa >= 90 ) {
55
+ } else if ( gpa >= 3.7 ) {
56
56
return "A-"
57
- } else if ( gpa >= 87 ) {
57
+ } else if ( gpa >= 3.3 ) {
58
58
return "B+"
59
- } else if ( gpa >= 83 ) {
59
+ } else if ( gpa >= 3.0 ) {
60
60
return "B"
61
- } else if ( gpa >= 80 ) {
61
+ } else if ( gpa >= 2.7 ) {
62
62
return "B-"
63
- } else if ( gpa >= 77 ) {
63
+ } else if ( gpa >= 2.3 ) {
64
64
return "C+"
65
- } else if ( gpa >= 73 ) {
65
+ } else if ( gpa >= 2.0 ) {
66
66
return "C"
67
- } else if ( gpa >= 70 ) {
67
+ } else if ( gpa >= 1.7 ) {
68
68
return "C-" ;
69
- } else if ( gpa >= 67 ) {
69
+ } else if ( gpa >= 1.3 ) {
70
70
return "D+" ;
71
- } else if ( gpa >= 65 ) {
71
+ } else if ( gpa >= 1.0 ) {
72
72
return "D" ;
73
73
} else {
74
74
return "F"
@@ -117,7 +117,9 @@ export function addNumbers(values: number[]): number {
117
117
export function getFirstNFibonacciNumbers ( n : number ) : number [ ] {
118
118
119
119
const array = [ n ]
120
-
120
+ if ( n == 0 ) {
121
+ return array ;
122
+ }
121
123
for ( let i = 2 ; i < n ; i ++ ) {
122
124
const cont = array [ i - 1 ] + array [ i - 2 ] ;
123
125
array . push ( cont )
You can’t perform that action at this time.
0 commit comments