Q9 Write a program to find the range of a set of numbers entered through the keyboard. Range is the difference between the smallest and biggest number in the list.

Program: 102

Write a c program to find the range of a set of numbers entered through the keyboard. Range is the difference between the smallest and biggest number in the list.

Integer range:

Use #include<climits> or #include<limits.h>

create a variable and assign the following values

int max = INT_MAX

int min = INT_MIN

Output:

  • max = 2147483647
  • min = -2147483648

Output:

Enter an integer: 5
You want to add another integer(y/n)?: y
Enter an integer: 10
You want to add another integer(y/n)?: y
Enter an integer: -10
You want to add another integer(y/n)?: y
Enter an integer: -50
You want to add another integer(y/n)?: n
Range is 60

Lokesh Kumar

Being EASTER SCIENCE's founder, Lokesh Kumar wants to share his knowledge and ideas. His motive is "We assist you to choose the best", He believes in different thinking.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.