Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is the problem, and this below is my code. how can I make this be a constant loop so it can keep asking for

image text in transcribed

This is the problem, and this below is my code. how can I make this be a constant loop so it can keep asking for a new user year input?

Program:

#include #include int main(void) { int year;// to hold year entered by user printf("Enter year: ");//asking user to enter year scanf("%d",&year);//reading into year //printing results if(abs(year-1912)%12==0) printf("rat"); else if(abs(year-1912)%12==1) printf("Ox"); else if(abs(year-1912)%12==2) printf("Tiger"); else if(abs(year-1912)%12==3) printf("Rabbit"); else if(abs(year-1912)%12==4) printf("Dragon"); else if(abs(year-1912)%12==5) printf("Snake"); else if(abs(year-1912)%12==6) printf("Horse"); else if(abs(year-1912)%12==7) printf("Goast"); else if(abs(year-1912)%12==8) printf("Monkey"); else if(abs(year-1912)%12==9) printf("Rooster"); else if(abs(year-1912)%12==10) printf("Dog"); else printf("Pig"); return 0; }

Output:

gcc version 4.6.3 Enter year: 2019 Pig

Chinese Zodiac (The 12 Animal Signs) In the Chinese calendar, every year is associated with a particular animal. The 12-year animal cycle is rat, ox, tiger, rabbit, dragon, snake, horse, goat, monkey, rooster, dog, and boar. The year 1912 is a year of rat; thus 1913 is a year of the ox and 1924 is another year of the rat. If you know in what year a person was born, you can compute the offset from 1912 and determine the animal associated with that person's year of birth. Step1: Create a program that determines the animal corresponding to an input year of birth. Assume that the input year is 1912 or later. Input: Year of birth Output: Corresponding animal from the Chinese calendar. Step2: Test your program using the following program Test Case: 1924 1948 1960 1961 1962 1963 1972 1973 1974 1975 1976 1977 1978 1979 1984 985 1986 1987 1988 O2% 1925 1937 1949 1997 1998 1999 2000 009 10 1927 1928 1929 1930 1931 1932 1933 1934 1935 1939 1940 1952 2012 1953 Hors 942 2002 014 Shesep 1955 1956 1957 1958 1959 1967 1991 1992 1993 1994 1943 2004 2005 2006 2007 Rooster 1945 1946 947 1969 1970 971 017 Dog 1982 18

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions

Question

How to find if any no. is divisble by 4 or not ?

Answered: 1 week ago

Question

Explain the Pascals Law ?

Answered: 1 week ago

Question

What are the objectives of performance appraisal ?

Answered: 1 week ago

Question

=+you think is being taxed when more money is printed? Why?

Answered: 1 week ago