Answer to Question #288019 in C for Nani

Question #288019

number of elements in an array between upper and lower bounds program

1
Expert's answer
2022-01-17T00:34:15-0500
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>


#define MAX_SIZE	100
#define UPPER_BOUND	100
#define LOWER_BOUND	0


int main()
{
	int Num[MAX_SIZE],n=0,SEED=1,Count=0;
	srand(SEED); 
    for(n=0;n<MAX_SIZE;n++) 
	{
		Num[n]  = rand();
		if(Num[n]>=LOWER_BOUND && Num[n]<+UPPER_BOUND)	Count++;
	}
	printf("\n\tLower Bound = %d",LOWER_BOUND);
	printf("\n\tUpper Bound = %d",UPPER_BOUND);
	printf("\n\tno. of elements betwee lower and upper bound = %d",Count);
	return(0);
	
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS