1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
alukav5142 [94]
2 years ago
6

Write a function that receives two numbers, m and n and calculates and displays the sum of the integers from m to n. For example

, if the arguments are m = 3 and n = 7, the function should calculate 3 + 4 + 5 + 6 + 7
Computers and Technology
1 answer:
Evgesh-ka [11]2 years ago
7 0

Answer:

The program to this question as follows:

Program:

//header file

#include <stdio.h> //defining header file

void inc(int m,int n) //defining method inc

{

   int sum, i; //declaring variable

   sum=m; //holding value of m variable

   for(i=++m;i<=n;i++) //loop for calculate number between given range  

   {

   sum=sum+i; //adding value

   }

   printf("sum of the integer is : %d",sum);//print value

}

int main() //defining method

{

   int m,n; //defining integer variable

   printf("Enter m value: "); //message

   scanf("%d",&m); //input value by user in variable

   printf("Enter n value: "); //message

   scanf("%d",&n);//input value by user in variable

   inc(m,n); //calling method

   return 0;

}

Output:

Enter m value: 3

Enter n value: 7

sum of the integer is :25

Explanation:

In the above code, an "inc" function is declared, that accepts integer parameters that are "m and n", inside the method two integer variable "sum and i" is declared, which is used in the loop.

  • The loop uses the user parameter to count value and uses the sum variable to calculate there sum.
  • In the main method, two integer variable n and m are declared, which take value from the user end, and at the last, we call the inc method, that prints sum value.
You might be interested in
The _____ row is typically the first row in a table.<br><br> banded<br> total<br> header<br> odd
rusak2 [61]

the first row of the table is know as the table header.

8 0
2 years ago
Read 2 more answers
Henry is designing a document for his architecture project. In which order should Henry preform the different tasks that are req
nadezda [96]

It is

Select an appropriate layout

Decide which current format...

Import or compose...

Proofread...

Check the print preview..

4 0
3 years ago
Does technology make us more alone?
Anika [276]
Both yeah and no, depending on personal opinion
3 0
3 years ago
1.) A ____ is a piece of information.
alukav5142 [94]

Answer:

pasensya na Hindi ko alam Ang sasabihin

5 0
3 years ago
When you run __________ on your hard drive, files are reorganized, making the hard drive work more efficiently.
andre [41]

Answer:

Disk Defragmenter

Explanation:

6 0
1 year ago
Other questions:
  • How to transfer photos from iphone to computer
    14·1 answer
  • Hypertext Markup language (HTML) version _____ added support for style sheets to give web designers greater control over page la
    12·1 answer
  • All of the following are challenges presented by changing technology as it relates to the special events field EXCEPT: A. the ab
    13·1 answer
  • Which of the following is not an example of plagiarism?
    10·1 answer
  • Unwanted email sent to large groups of people who did not request the communication is called _____
    12·1 answer
  • What is the web page path on the web server for the URL:
    12·1 answer
  • The people on this platform are unbelievably nice. its almost rare to see this type of kindness online these days. Just wanted t
    14·1 answer
  • Who invented computer ?​
    9·2 answers
  • In the software development process, which review studies the software design before it is released for coding?
    7·1 answer
  • The ________ is the biggest power consumer on a mobile computing device. display CPU memory module hard drive
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!