#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int count,i, tracker = 0;
int
main() {
scanf("%d\n", &count);
int numbers[count];
//GEtting the numbers and satisfy BS conditions
for (i = 0; i < count; i++) {
if (scanf("%d", &numbers[i]) != EOF) {
tracker++;
}
if (numbers[i] < 0 || numbers[i] > 99) {
printf("%d is not in the [0, 99] range.\n",numbers[i]);
exit(i);
}
}
if( tracker != count) {
printf("%d numbers are required, but only %d were provided.\n", count, tracker);
exit(1);
}
int bins[10] = {0,0,0,0,0,0,0,0,0,0};
int bin_number;
for(i = 0; i < count;i++) {
bin_number = numbers[i] / 10;
bins[bin_number]++;
}
float D = 0;
for (i = 0;i < 10;i++) {
D += pow((i-bins[i] + 1),2)/bins[i];
printf("Bin # %d has %d\n",i +1,bins[i]);
}
if (D <= 14.684) {
printf("The sequence is consistent with the uniform distribution (D = %.2f).\n", D);
}
else if (D > 14.684 && D <= 21.666) {
printf("The sequence is suspicious (D = %.2f).\n", D);
}
else {
printf("The sequence is unlikely to come from a uniform distribution (D = %.2f).\n", D);
}
}
Why does my tracker not print out at all??
`Hey,
Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int count,i, tracker = 0;
int
main() {
scanf("%d\n", &count);
int numbers[count];
//GEtting the numbers and satisfy BS conditions
for (i = 0; i < count; i++) {
if (scanf("%d", &numbers[i])) {
tracker++;
}
if (numbers[i] < 0 || numbers[i] > 99) {
printf("%d is not in the [0, 99] range.\n",numbers[i]);
exit(i);
}
}
if( tracker != count) {
printf("%d numbers are required, but only %d were provided.\n",
count, tracker);
exit(1);
}
int bins[10] = {0,0,0,0,0,0,0,0,0,0};
int bin_number;
for(i = 0; i < count;i++) {
bin_number = numbers[i] / 10;
bins[bin_number]++;
}
float D = 0;
for (i = 0;i < 10;i++) {
if(bins[i]!=0)
D += (float)pow((i-bins[i] + 1),2)/(float)bins[i];
printf("Bin # %d has %d\n",i +1,bins[i]);
}
if (D <= 14.684) {
printf("The sequence is consistent with the uniform distribution (D
= %.2f).\n", D);
}
else if (D > 14.684 && D <= 21.666) {
printf("The sequence is suspicious (D = %.2f).\n", D);
}
else {
printf("The sequence is unlikely to come from a uniform
distribution (D = %.2f).\n", D);
}
}

Kindly revert for any queries
Thanks.
#include <stdio.h> #include <stdlib.h> #include <math.h> int count,i, tracker = 0; int main() { scanf("%d\n", &count);...
#include<stdio.h> int main() { int i; printf("Type an integer value: "); scanf("%d",&i); evaluate(i); return(0); } void evaluate(int x) { if(x > 10) printf("Value entered by you is greater than 10"); else if(x < 10) printf("Value entered by you is less than 10"); else printf("Value entered by you is equal 10"); } _______________________________________ report for this in hr ?
Draw the flowchart of the following program: # include < stdio.h> # include < math.h> int main (void) {double time, velocity, acceleration; print f("Enter new time value in second: \n"); scanf("% 1f", & time); if (time = = 1)} velocity = 0.5 * pow (time, 3); acceleration = 0.5* velocity * velocity;); if (time = = 0.5 * pow (time, 3); acceleration = .5 velocity * velocity;} else {velocity = 1.5 * pow (time, 3); acceleration = 1.5 * velocity...
#include <stdio.h> #include <string.h> #include <ctype.h> #include <stdlib.h> int main(void) { /* Type your code here. */ int GetNumOfNonWSCharacters(const char usrStr[]) { int length; int i; int count = 0; char c; length=strlen(usrStr); for (i = 0; i < length; i++) { c=usrStr[i]; if ( c!=' ' ) { count++; } } return count; } int GetNumOfWords(const char usrStr[]) { int counted = 0; // result // state: const char* it = usrStr; int inword = 0; do switch(*it)...
Fix the errors in C code #include <stdio.h> #include <stdlib.h> void insertAt(int *, int); void Delete(int *); void replaceAt(int *, int, int); int isEmpty(int *, int); int isFull(int *, int); void removeAt(int *, int); void printList(int *, int); int main() { int *a; int arraySize=0,l=0,loc=0; int choice; while(1) { printf("\n Main Menu"); printf("\n 1.Create list\n 2.Insert element at particular position\n 3.Delete list.\n4. Remove an element at given position \n 5.Replace an element at given position\n 6. Check the size of...
Do you have a flowgorithim flow chart for this code? #include <stdio.h> int main() { int num,i=0,sum=0; float average; int customerNumbers[num]; int customerSales[num]; printf("How many customers do you want to track?\n"); scanf("%d",&num); while(i<num) { printf("Enter the customer number. "); scanf("%d",&customerNumbers[i]); printf("Enter the sales for the customer "); scanf("%d",&customerSales[i]); i++; } printf("Sales for the Customer"); printf("\nCustomer Customer"); printf("\nNumber Sales"); for(i=0;i<num;i++) { printf("\n %d \t %d",customerNumbers[i], customerSales[i]); sum=sum+customerSales[i]; } average=(int)sum/num; printf("\n Total sales are $%d",sum); printf("\n Average sales are $%.2f",average); printf("\n --------------------------------------------");...
i need flowchart for the following c code #include <stdio.h> int main() { int n, i, sum = 0; printf("Enter an integer: "); scanf("%d",&n); i = 1; while ( i <=n ) { sum += i; ++i; } printf("Sum = %d",sum); return 0; }
#include <stdio.h> #include<string.h> int main() { char strText[100] ="Start"; char i; int nTextASCIISum = strText[0] + strText[1] + strText[2]; int nTextLen = strlen(strText); int count = 0; printf("Welcome to token generator!\n"); printf("Enter a word to use in the token generator.\n You may enter as many words as you like. \n Press q and key when finished.\n"); scanf("%c", &strText[i]); //compute when to stop loop //check nTextLen == 1 and strText[0] == 'q' for(i=0;i< nTextLen;i++) if ((strlen(strText) != 1) || (strText[0] !=...
sort.c
#include <stdlib.h>
#include <stdio.h>
#include "libsort.h"
int main()
{
int* array;
int size, c;
float median;
printf("Enter the array size:\n");
scanf("%d", &size);
array = (int*) malloc(size *
sizeof(int));
printf("Enter %d integers:\n", size);
for (c = 0; c < size; c++)
scanf("%d",
&array[c]);
sort(array, size);
printf("Array sorted in ascending
order:\n");
for (c = 0; c < size; c++)
printf("%d ",
array[c]);
printf("\n");
median = find_median(array,...
Translate the following C program to Pep/9 assembly language. #include <stdio.h> int main() { int number; scanf("%d", &number); if (number % 2 == 0) { printf("Even\n"); } else { printf("Odd\n"); } return 0; }
#include<stdio.h>
#include<stdlib.h>
#include <time.h>
int main()
{
/* first you have to let the computer generate a random number.
Then it has to declare how many tries the user has for the game
loop.
we then need the player to enter their guess. After every guess we
have to give an output of how many numbers they have in the right
location
and how many they have the right number. The player will keep
guessing until their 10 tries are...