In: Computer Science
Complete function PrintPopcornTime(), with int parameter bagOunces, and void return type. If bagOunces is less than 3, print "Too small". If greater than 10, print "Too large". Otherwise, compute and print 6 * bagOunces followed by " seconds". End with a newline. Example output for ounces = 7:
42 seconds
#include <stdio.h>
void PrintPopcornTime(int bagOunces) {
}
int main(void) {
int userOunces;
scanf("%d", &userOunces);
PrintPopcornTime(userOunces);
return 0;
}
2. Write a function PrintShampooInstructions(), with int parameter numCycles, and void return type. If numCycles is less than 1, print "Too few.". If more than 4, print "Too many.". Else, print "N: Lather and rinse." numCycles times, where N is the cycle number, followed by "Done.". End with a newline. Example output with input 2:
1: Lather and rinse. 2: Lather and rinse. Done.
Hint: Declare and use a loop variable.
#include <stdio.h>
/* Your solution goes here */
int main(void) {
int userCycles;
scanf("%d", &userCycles);
PrintShampooInstructions(userCycles);
return 0;
}
Note: Could you plz go through this code and let me
know if u need any changes in this.Thank You
_________________
1)
#include <stdio.h>
void PrintPopcornTime(int bagOunces) {
if(bagOunces<3)
{
printf("Too small.\n");
}
else if(bagOunces>10)
{
printf("Too large.\n");
}
else
{
printf("%d seconds\n",6*bagOunces);
}
}
int main(void) {
int userOunces;
scanf("%d", &userOunces);
PrintPopcornTime(userOunces);
return 0;
}
___________________________
Output:
_____________________________
2)
#include <stdio.h>
/* Your solution goes here */
void PrintShampooInstructions(int userCycles)
{
if(userCycles<1)
{
printf("\nToo few.\n");
}
else if(userCycles>4)
{
printf("\nToo many.\n");
}
else
{
int i;
for(i=1;i<=userCycles;i++)
{
printf("%d:
Lather and rinse.\n",i);
}
printf("Done\n");
}
}
int main(void) {
int userCycles;
scanf("%d", &userCycles);
PrintShampooInstructions(userCycles);
return 0;
}
__________________________
Output:
_______________Could you plz rate me well.Thank
You