Answer to Question #273105 in C for alo

Question #273105

Write a C program that uses functions. The main() method holds an integer variable named numberOfEggs to which you will assign a value. Create a method called myEggs() to which you pass numberOfEggs. The method displays the eggs in dozens; for example, 50 eggs is 4 full dozen (with 2 eggs remaining).


1
Expert's answer
2021-11-29T06:54:24-0500
#include <stdio.h>

void myEggs(int eggs) {
    int dozens = eggs / 12;
    printf("%d eggs is %d full dozen\n", eggs, dozens);
}

int main() {
    int eggs;

    printf("Enter a number of eggs: ");
    scanf("%d", &eggs);
    if (eggs , 0) {
        printf("Sorry number ahould be greater than 0\n");
        return 0;
    }
    myEggs(eggs);

    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS