To find the range of set of numbers in c using loop
Answers
Answered by
0
#include<stdio.h>
main()
{
int largest=-30000,smalest=30000,range,num;
char choice='y';
clrscr();
while(choice=='y')
{printf("input a number=");
scanf("%d",&num);
if(num>largest)
largest=num;
if(smalest>num)
smalest=num;
printf("do you want to add another number y/n=");
scanf("%c",choice);
choice=getche();}
range=largest-smalest;
printf("range is %d",range);
getch();
}
Similar questions
Political Science,
6 months ago
Math,
6 months ago
Science,
6 months ago
Biology,
11 months ago
Physics,
11 months ago
Social Sciences,
1 year ago
Math,
1 year ago