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 first. */ #include<stdio.h> #include<conio.h> #include<limits.h> void main() { int num; int min=INT_MIN,max=INT_MAX; char choice='y'; do{ printf("Enter an integer:"); scanf("%d",&num); // find the maximum and minimum value within inputs // lits of numbers if(num>min) min=num; if(num<max) max=num; // ask for user choice to add another number printf("You want to add another integer(y/n)?:"); scanf("%c",&choice); } while(choice=='Y'||choice=='y'); printf("Range is %d",(min-max)); return 0; }
0 Comments