1. ## Help please.

My partner and I are running into a problem in a project we are doing. We are supposed to prompt for a nonnegative seed value, a range, and a number between (10 , 50) of random numbers to generate. The program does other various things after this. The program executes perfectly, but our tests are not working at all, it will pass through the program no matter what numbers you enter. If someone could please give me and example of the best way to test values it would be GREATLY appreciated.

2. Instead of asking the program from others,you post your code.We will look on it and help you.We don't know what algorithm and how did you implement the code.For testing the values given by user,you can use if-else conditional statements or switch statements.
The following simple example code.

Code:
```#include	<stdio.h>
int
main ( int argc, char *argv[] )
{
int a;
printf ( "Enter the value:"  );
scanf("%d",&a);
switch(a)
{
case 0:
printf ( "Given Value is 0\n"  );
break;
case 1:
printf ( "Given Value is 1\n"  );
break;
default:
printf ( "Given Value is %d\n",a  );
break;
}
if(a>1)
printf ( "Given Value a is greater than 1\n"  );
else if(a==1)
printf ( "Given Value a is equal to 1\n"  );
else
printf ( "Given Value a is less than 1\n"  );
return 0;
}```

3. Try this code , This is a simple code for comparing values ,

Code:
```#define MIN_VALUE 10
#define MAX_VALUE 50

int
main ( int argc, char *argv[] )
{
int a;
printf ( "Enter the value:"  );
scanf("%d",&a);

( a>=MIN_VALUE && a<=MAX_VALUE )?printf("Condition is passed :%d\nValue is in between %d and %d\n" ,a,MIN_VALUE , MAX_VALUE):printf("VAlue is not in between %d and %d\n" ,MIN_VALUE , MAX_VALUE);
}```
If u paste your code then we can find what is the actual problem you are facing.

4. You could simplify that printf statement. The only thing that changes between them is the not word. So make the condition around the not word depending on the a value.

Popular pages Recent additions