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

I am having an issue running this program in C. I\'m completely at a loss. Any h

ID: 3905086 • Letter: I

Question

I am having an issue running this program in C. I'm completely at a loss. Any help or suggestions would be greatly appreciated. Thank you in advance!

Description:

Same as program 4a; but you I expect precise output

Match output in images to the right – before you try the quiz

These images must be removed when you submit, or you get a 0

Plan: roll 2 10 sided dice

Input:

S, seed value   ( for use in srand, for testing )

N, number of rolls

Output:For N up to 10, print out each roll value

don't print rolls for larger values of N

How many times were doubles/pairs rolled?

How many times was the sum 15

This is what I have so far:

#include <stdio.h>
int main()

{
int s, n, i, side;
int sum = 0, pairs = 0;
int roll1, roll2;

printf("Seed: ");
scanf("%d", &n);
srand(s);
printf("Rolls: ");
scanf("%d", &n);
for ( i = 1; i < n; i++);
{
roll1 = i + 1;
roll2 = i + 1;
if (roll1 == roll2)
pairs++;

if (roll1 + roll2 == 15)
sum++;

printf("Dice 1 = %d Dice 2 = %d ", roll1, roll2);
}

printf("Pairs: %d ", pairs);
printf("Sum: %d ", sum);


return 0;
}

Explanation / Answer

If you have any doubts, please give me comment...

the two dice sum 15 is rearely come, because dice 1 is 6 sided by default, dice 2 is 10 sided by problem statement, it will come if and only if dice1 is 6 and dice 2 is 9 or dice1 is 5 and dice 2 is 10

#include <stdio.h>

int main()

{

int s, n, i, side;

int sum = 0, pairs = 0;

int roll1, roll2;

printf("Seed: ");

scanf("%d", &n);

srand(n);

printf("Rolls: ");

scanf("%d", &n);

for (i = 1; i < n; i++)

{

roll1 = rand()%6+ 1;

roll2 = rand()%10 + 1;

if (roll1 == roll2)

pairs++;

if (roll1 + roll2 == 15)

sum++;

printf("Dice 1 = %d Dice 2 = %d ", roll1, roll2);

}

printf("Pairs: %d ", pairs);

printf("Sum: %d ", sum);

return 0;

}