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

Write a program that asks the user for meditation numbers. oThe user should be a

ID: 3700320 • Letter: W

Question

Write a program that asks the user for meditation numbers.

oThe user should be allowed to enter as many data set as desired (or enter -999 to quit).

oYou must use do...while or while loop.

oThe output should look like the example output shown.

oIndicate if an entered number is divisible by three or divisible by four.

oThe program should output the number of numbers divisible by three, their sum and average.

oThe program should output the number of numbers divisible by four, their sum and average

Richard Ricardo's Kung Fu Panda Po Divisibility (3s and 4s) Log Click on the button to enter Po's meditation numbers. Richard will keep track of numbers divisible by three and four. Richards Po mecitaon numbers Po's Meditation Numbers:

Explanation / Answer

#include <stdio.h>
#include <stdlib.h>

int main()
{
int i=0,no[1000],four=0,three=0,sum3=0,sum4=0;
do{

printf("Enter the no(-999 to quit) :");
scanf("%d",no+i);
if(no[i]%3==0&&no[i]!=-999){
three++;
sum3+=no[i];
}
if(no[i]%4==0){
four++;
sum4+=no[i];
}
}while(no[i++]!=-999);
for(i=0;no[i]!=-999;i++)
{
if(no[i]%3==0)
printf("%d is divisible by three ",no[i]);
if(no[i]%4==0)
printf("%d is divisible by four ",no[i]);
}
if(no[0]!=-999){
printf(" ");
printf("You entered %d numbers divisible by three ",three);
printf("The sum of these of numbers is %d ",sum3);
if(three==0){
printf("The average of these numbers = 0 ");
}else
printf("The average of these numbers = %d/%d = %.2f",sum3,three,(float)sum3/three);

printf(" ");
printf("You entered %d numbers divisible by three ",four);
printf("The sum of these of numbers is %d ",sum4);
if(four==0){
printf("The average of these numbers = 0 ");
}else
printf("The average of these numbers = %d/%d = %.2f",sum4,four,(float)sum4/four);
}
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