Skip to content

Instantly share code, notes, and snippets.

@lordvidex
Last active March 30, 2020 13:23
Show Gist options
  • Save lordvidex/addb3a132cd91684b64500222a389ee3 to your computer and use it in GitHub Desktop.
Save lordvidex/addb3a132cd91684b64500222a389ee3 to your computer and use it in GitHub Desktop.
Evans Owamoyo:: Day 5 Track 1
import 'dart:math';
String differenceOfSquares(int n){
//absolute difference of squares of sum &&& sum of squares
return (pow((n*(n+1))/2,2)-((n*(n+1)*(2*n+1))/6)).abs().toStringAsFixed(0);
}
void main() {
int n = 10;
print(differenceOfSquares(n));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment