No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
3 Posted Topics
hi i want to generate non repeated random numbers many times. for that i m using the following code. [code]#include "sys/types.h" #include "stdio.h" #define MAX 200 #define N 20 main() { int array[N],r; int n = 0; int count_check,count_gen ,i,j; for(j=0;j<10;j++,printf("\n")) { srand(j); for (count_gen=0;count_gen<=MAX;count_gen++) { r = rand()%N; for …
i want to generate non repeated random numbers from 0 to 156. here is the code for the purpose. but when i try to generate the random numbers more then 1 time by using a for loop, the same pattern on numbers repeats. how to solve this problem ? #include …
hi here is the solution for your problem. [code]#include "stdio.h" #define NUM_CUSTOMERS 3 main() { int num_hours ,customers; float charge_min = 2.0,rate = 0.5 , charge_max = 10.; float calculate_charge; for(customers=1;customers<= NUM_CUSTOMERS ; ustomers++) { printf("enter the number of hours\n"); scanf("%d",&num_hours); if(num_hours<=3) calculate_charge = charge_min; else { if (num_hours<19) calculate_charge …
The End.
xshashiy