Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Modify rumple 3 from class on Oct 21\" to generate 100 random numbers from 0 to

ID: 3763237 • Letter: M

Question

Modify rumple 3 from class on Oct 21" to generate 100 random numbers from 0 to 9 Use a "For" loop at the counter. Once a. Is working, store all 100 numbers in an array called 'a'. Create a 2^nd for loop that will print all 100 values from the array Submit this as Lab 11a.c Now create a 2^nd array called 'count' with a size of 10. Within the loop printing the 100 values, add one to the appropriate index of 'count' for the value in 'a' (i.e, if a=3 then increment count[3]). Using a 3^rd loop, print the index and count value for that index in an appropriately formatted table such as: Turn this program in as Lab11b c. Now add the appropriate code to add a bar graph for each value of count. Print this next to the table. The output should look as follows: Turn in this program in as lab11c.c.

Explanation / Answer

lab11a.c

#include <stdio.h>

int main()
{
int i;
int a[100];
for(i=0;i<100;i++)
{
a[i] = rand()%10;
}
for(i=0;i<100;i++)
{
printf("%d ",a[i]);
}
return 0;
}

lab11b.c

#include <stdio.h>

int main()
{
int i;
int a[100];
int count[10]={0};
for(i=0;i<100;i++)
{
a[i] = rand()%10;
}
for(i=0;i<100;i++)
{
count[a[i]]++;
}
printf("Value Count ");
for(i=0;i<10;i++)
{
printf("%d %d ",i,count[i]);
}
return 0;
}

lab11c.c

#include <stdio.h>

int main()
{
int i,j;
int a[100];
int count[10]={0};
for(i=0;i<100;i++)
{
a[i] = rand()%10;
}
for(i=0;i<100;i++)
{
count[a[i]]++;
}
printf("Value Count Graph ");
for(i=0;i<10;i++)
{
printf("%d %d ",i,count[i]);
for(j=0;j<count[i];j++)
{
printf("*");
}
printf(" ");
}
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote