Write a program in which given an integer num, return the sum of the multiples of num between 1 and 100. For example, if num is
20, the returned value should be the sum of 20, 40, 60, 80, and 100, which is 300. If num is not positive, return 0.
1 answer:
Answer:
#include<iostream>
using namespace std;
int main()
{
int num=0,sum=0;
cout<<"Insert Number to find sum of mutiples.";
cin>>num;
int temp=num;
if(num>0){
sum+=num;
while(num<100){
num+=temp;
sum+=num;
}
cout<<"Sum of Multiples is ="<<sum<<endl;
}else{
return 0;
}
return 0;
}
Explanation:
This code is written in c++. Written by Saad-Ur-Rehman.
You might be interested in
Answer:birthday
Explanation:
Answer:
Explanation:
What game is this
the answer is D. without the right tags the content wont be accurately indexed
Answer:
= 1 off!
Explanation:
1x1
Answer: resume
Explanation: