+ 2

Implement the yesOrNo () function, which asks for the number n. Next, we enter n numbers and store all entered numbers into an

Implement the yesOrNo () function, which asks for the number n. Next, we enter n numbers and store all entered numbers into an array. The program should check if it alternates between positive and negative numbers. If alternating, output YES, otherwise NO. For example: Input: Input: 6 8 -2 4 6 9 12 6 4 -2 7 -5 13 -16 Output: Output: NO YES package main import "fmt" func main () { var n [5] int fmt.Scanln (& n) fmt.Println (n [1]) } Is my scan not working?

23rd Oct 2021, 4:12 AM
Zhenis Otarbay
Zhenis Otarbay - avatar
1 Réponse
+ 3
Save your code in code playground and share the link in your question. Tag appropriate programming language. Choose the question heading appropriate so that it describes what the question is based on. All the best =)
23rd Oct 2021, 6:07 AM
Rishi
Rishi - avatar