From 59447cd7f754b952bddee637bd680cc3c5c001ec Mon Sep 17 00:00:00 2001 From: Firoz Hussain <87609163+Firoz1212@users.noreply.github.com> Date: Thu, 22 Dec 2022 11:44:36 +0530 Subject: [PATCH] Create Sum of 7's Multiple.cpp --- Math/Sum of 7's Multiple.cpp | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Math/Sum of 7's Multiple.cpp diff --git a/Math/Sum of 7's Multiple.cpp b/Math/Sum of 7's Multiple.cpp new file mode 100644 index 0000000..02299a5 --- /dev/null +++ b/Math/Sum of 7's Multiple.cpp @@ -0,0 +1,7 @@ +long Solution::solve(int A, int B) { + if(A%7) A+=(7-A%7); + B-=B%7; + int n=(B-A)/7+1; + long long result=(long)n * long(A+B)/2; + return result; +}