Computer Science, asked by pDivya24, 6 months ago

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 codecracker
0

Answer:

public int sumbuzz(int n)

{

int sum=0;

for(int i=1;i<=n;i++)

{

sum=sum+i;

}

}

Answered by vijayghore
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