Write a program to input a number and print the sum of all the buzz number from 1 to given number using the function public int sumbuzz(int n)
Answers
Answered by
0
Answer:
public int sumbuzz(int n)
{
int sum=0;
for(int i=1;i<=n;i++)
{
sum=sum+i;
}
}
Answered by
0
Answer:
#include<iostream>
using namespace std;
int sumbuzz(int);
int main()
{
int n;
cout<<"Enter a number";
cin>>n;
if(n%7 ==0 || n%10=7)
{
int bn = sumbuzz(n);
cout<<"Sum of buzznumber is = "<<bn;
}
else
{
cout<<"Entered number is not buzz number";
}
return 0;
}
int sumbuzz(int n)
{
int sum=0;
for(int i=1;i<=n;i++)
{
sum+=n;
}
return sum;
}
Similar questions
English,
2 months ago
English,
2 months ago
Hindi,
2 months ago
English,
6 months ago
Social Sciences,
10 months ago