A few questions, all involving "for" loops that I am unsure how to do (Thank you in advance for the help):

Q1.) Write a table of conversions from Celsius to Rankin. Allow the user to enter the starting temperature and increment between lines. Print 25 lines in the table. Use a "for" loop in your solution. Print with 3 digits after the decimal for all values.

My code followed by my issues:

#include <stdio.h>

int main()
{

double C;
double R;
double i;
int count=0;

printf("Enter a value in Celsius: \n");
scanf("%f",&C);
printf("\nEnter the amount to increment by: \n");
scanf("%f",&i);

printf("Celcius\t Rankin\n");

for(count=0;count=25;count++)
{
R = 9/5.0*(C+273.15);
printf("%.3f\t\t %.3f\n",C,R);
}


return 0;

Issues:

a.)Since I have to use a for loop and the value of Celsius (and the incrementation) is defined by the user I feel that the "for" loop needs to use the incrementation itself ("count") as it's parameter but I'm unsure how to proceed.

b.) Can I have multiple variables in my "for" loop? Do I need to use a nested "for loop ("for" "if" or "while" loop inside a "for loop")here?

Q2.) Write a program that asks the user to enter a list of integers. The program will then determine the largest value entered and the number of times it was entered.
• The user will first enter how many numbers the list contains.
• Use a for loop to find the maximum value and the number of times it was entered

code (VERY incomplete!):

#include <stdio.h>

int main()
{
//Variable declarations
int num;
int amount;
int min;
int max;



printf("Enter the number of elements in the list: \n");
scanf("%d",&amount);

printf("Enter the elements in the list: \n");
scanf("%d",&num)


min = num;
max = num;


//also finding the smallest number
for(num!=a;)
{
}
}


The fact of the matter I'm not even sure of where to start here; in a previous assignment we used a "while" loop to find the min. and max. but not to find the number of iterations of the max number, and of course it was not a "for" loop.

Q1. Issues:

a.)Since I have to use a for loop and the value of Celsius (and the incrementation) is defined by the user I feel that the "for" loop needs to use the incrementation itself ("count") as it's parameter but I'm unsure how to proceed.
It is not clear from the instructions if it is permissible, but I would have asked the user for an integer value for the starting temperature and the increment. The same increment can be used in the for-loop in place of count.
This will avoid 99.999 degrees because of rounding.
If it is not permissible, you can add 0.0005 to the output values (define it as "final double eps=0.0005;").
For the increment, you only need to insert "C+=i;" after the print statement in the for-loop to give different values output. That is precisely where round-off errors can accumulate.
Also, it would be advisable to check the value of i that it is positive, i.e. not zero, and not negative.
You do not need a multiple for-loop, as there is only one variable (C) being incremented.

Q2. Issues
The fact of the matter I'm not even sure of where to start here; in a previous assignment we used a "while" loop to find the min. and max. but not to find the number of iterations of the max number, and of course it was not a "for" loop.

Indeed your code is very incomplete.
It is not clear to me whether you have done arrays. Using arrays, it is very easy to solve the problem. However, since we do not know the maximum size of the array, the size of the array must be declared at run time, which is a little more advanced.

It can be solved without using an array. You would scan the number of elements to be to entered (amount). Use a for-loop to go through the data entry "amount" times, each time prompting a value from the user.

You will need two count variables, countMax, and countMin, but preset to 1. on declaration.

On the first time only, set the max and min values to the first data value (num) entered (not "amount").

On subsequent iteration, compare num with min. If num is less than min, then set min to num and countMin=1.
If num==min, set countMin++.
Do a similar processing for max and countMax.

After the loop ends, print min, countMin, max, countMax.

Try to write a pseudocode and post if necessary for verification. Proceed with coding if you are pressed for time.
b.) Can I have multiple variables in my "for" loop? Do I need to use a nested "for loop ("for" "if" or "while" loop inside a "for loop")here?

Sorry, I just recognized that you programme in C. Consequently there may be a few syntax errors in my suggested code.

"final double eps=0.0001;" should now read
"const double eps=0.0001;"
(without the ").
The print statement for a "double" variable should have the template %.3lf instead of %.3f. This may be compiler dependent. %.3f is OK in Java.

Q1.) To write a table of conversions from Celsius to Rankin using a "for" loop, you can modify your code as follows:

```c
#include <stdio.h>

int main() {
double C;
double R;
double increment;
int count;

printf("Enter a value in Celsius: \n");
scanf("%lf", &C);
printf("\nEnter the amount to increment by: \n");
scanf("%lf", &increment);

printf("Celcius\t Rankin\n");

for (count = 0; count < 25; count++) {
R = (9.0 / 5.0 * (C + 273.15));
printf("%.3lf\t\t %.3lf\n", C, R);
C += increment;
}

return 0;
}
```

Explanation:
1. Use `%lf` to scan and print `double` values using `scanf` and `printf` respectively.
2. Initialize a variable `increment` to store the incrementation value entered by the user.
3. In the `for` loop, change the condition to `count < 25` so that the loop executes 25 times.
4. After printing the values, increment the value of `C` by the incrementation value (`C += increment`).

Q2.) To find the largest value entered and the number of times it was entered using a `for` loop, you can modify your code as follows:

```c
#include <stdio.h>

int main() {
int amount;
int num;
int max = -2147483648; // Initialize max to lowest possible value
int maxCount = 0;
int i;

printf("Enter the number of elements in the list: \n");
scanf("%d", &amount);

printf("Enter the elements in the list: \n");

for (i = 0; i < amount; i++) {
scanf("%d", &num);
if (num > max) {
max = num;
maxCount = 1; // Reset the count of max
} else if (num == max) {
maxCount++; // Increment the count of max
}
}

printf("The largest value entered is: %d\n", max);
printf("The number of times it was entered is: %d\n", maxCount);

return 0;
}
```

Explanation:
1. Initialize `max` to the lowest possible value (-2147483648 for a 32-bit integer) to ensure that any input number will be higher.
2. Initialize `maxCount` to 0 to keep track of the count of the maximum value.
3. Use a `for` loop with the range `0` to `amount - 1` to iterate over the elements.
4. Read each element using `scanf` and compare it with the current `max` value.
5. If the element is greater than `max`, update `max` and reset `maxCount` to 1.
6. If the element is equal to `max`, increment `maxCount` by 1.
7. Finally, print the `max` value and the `maxCount` value.