+ 1
How can I declare N in c++ like this? 1<N<10^6
I realy need your helps...
8 odpowiedzi
0
This is a very naive thinking but if you really want the number to be in range before further process then you can do something like this.
#include <stdio.h>
#include <math.h>
int main() {
unsigned long int a;
scanf("%ld",&a);
if((a>=1) && (a<=pow(10,6))){
printf("The number is in range");
//put your code inside
}
else{
printf("The number is not in range");
}
return 0;
}
+ 4
You can use constants to define the upper and lower limits and use if statements for checking like what Avinesh did.
+ 1
Are you missing an equal to symbol?
1<=N<=10^6
0
Did you mean to declare, or to check whether <N> meets the constraint `1 < N < 10 ^ 6` ?
0
I saw a question in university, about to declare N, that N is greater than 1 and less than 10^6
Anr I have no idea how to declare it .
0
Yes sth like that