Skip to content

A GoLang challenge to find sum of squares without using For loop

Notifications You must be signed in to change notification settings

pphowakande/go-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Description

We want you to calculate the sum of squares of given integers, excluding any negatives.
The first line of the input will be an integer N (1 <= N <= 100), indicating the number of test cases to follow.
Each of the test cases will consist of a line with an integer X (0 < X <= 100), followed by another line consisting of X number of space-separated integers Yn (-100 <= Yn <= 100).
For each test case, calculate the sum of squares of the integers, excluding any negatives, and print the calculated sum in the output.
Note: Do not put blank lines between test cases solutions.
Note 2: Take input from standard input, and output to standard output

=====================================================================

Rules

Write your solution using Go Programming Language
Your source code must be a single file (package main)
Do not use any for statement
You may only use standard library packages
Your program will be auto-tested, so please be strict about the input/output.

=====================================================================

Sample Input

2 4 3 -1 1 14 5 9 6 -53 32 16

=====================================================================

Sample Output

206 1397

=====================================================================

About

A GoLang challenge to find sum of squares without using For loop

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages