Question

write a program to ask the user if he or she wants to know about their...

write a program to ask the user if he or she wants to know about their birth stone. if they do, then display the 12 months and allow user to select the month of thier choice. give them info using their birth stone

0 0
Add a comment Improve this question Transcribed image text
Answer #1

//Code is explained in comments

//As you didnt specify birth language ,i used C language:

#include <stdio.h>

#include <stdlib.h>

#include <conio.h>

void main()

{

int mnth ;

char selection;

int i;

char x[12][10] = {"1.January" , "2.February" , "3.March" , "4.April" , "5.May" , "6.June" , "7.July" , "8.August" , "9.September" , "10.October", "11.November" , "12.December" } ;

//store month names in x

char y[12][15]={"Garnet","AMethyst","Aquamarine","Diamond","Emerald","Pearl","Ruby","Periodot","Sapphire","Opal","Citrine","Tanzanite"};

//store birth stones in y

printf("Enter 'y' if you want to know the birthstone or any letter if you dont\n");

scanf("%c",&selection);//ask the user whether he wants to know or not

if(selection=='y' || selection=='Y'){//if he enters y only ,it will enter to caluclate

for(i=0;i<12;i++){

printf("%s\n",x[i]);//display the months with number

}

printf("Enter the Birthday month number: ") ;

scanf("%d" , &mnth) ;//get the birth month nummber here

printf("Your birth stone is: %s" , y[m-1]) ;//display the corresponding stone in y

}else {

printf("Exiting the program as you dont want\n");

return 0;

}

return 0;

}

//output:

Enter y if you want to know the birthstone or any letter if you dont 1.January 2.February 3.March 4.April 5 May 6. June 7.Ju

PS:If you like the answer ,pleasse upvote

Add a comment
Know the answer?
Add Answer to:
write a program to ask the user if he or she wants to know about their...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • JAVA HELP Create a small program where You ask the user The amount of money he/she...

    JAVA HELP Create a small program where You ask the user The amount of money he/she wants to convert using GUI Pop up input (import javax.swing.JOptionPane;) The first pop up should ask the user to what currency he/she wants to convert, He needs to be able to click that option, The currency you should use are : Euros , Pesos , Yen , Pound , Ruble, Quetzal, Once the user Clicks the option It will ask The amount the user...

  • This is a Java text only program. This program will ask if the user wants to...

    This is a Java text only program. This program will ask if the user wants to create a music playlist. If user says he or she would like to create this playlist, then the program should first ask for a name for the playlist and how many songs will be in the playlist. The user should be informed that playlist should have a minimum of 3 songs and a maximum of 10 songs. Next, the program will begin a loop...

  • Write a program that ask the user for the year he/she was born, then outputs "Hi"...

    Write a program that ask the user for the year he/she was born, then outputs "Hi" if the user is less than 18 years old but "Hello" if the user is 18 or older. The program should print "Bye" at the end. cpp.

  • Problem 1 Write a Python program to do the following: (A) Ask the user to enter...

    Problem 1 Write a Python program to do the following: (A) Ask the user to enter as many integers from 1 to 10 as he/she wants. Store the integers entered by the user in a list. Every time after the user has entered an integer, use a yes/no type question to ask whether he/she wants to enter another one. (B) Display the list. (C) Calculate and display the average of the integers in the list. (D) If the average is...

  • Please write a Java program that ask the user how many beers he or she expects...

    Please write a Java program that ask the user how many beers he or she expects to consume each day, on average, as well as the average amount of money he or she spends on a single 12-ounce can of beer. Studies have shown that, on average, someone who consumes a single 12-ounce can of beer every day without compensating for the calorie intake through diet modifications or extra exercise, will gain approximately 15 pounds in one year. You can...

  • Write a C# program that prompts a user to enter a birth month and day. Display...

    Write a C# program that prompts a user to enter a birth month and day. Display an error message if the month is invalid (not 1 through 12) or the day is invalid for the month (for example, not between 1 and 31 for January or between 1 and 29 for February). If the month and day are valid, display them with a message.

  • Write a C program that prompts the user for the number for times the user wants...

    Write a C program that prompts the user for the number for times the user wants to flip a coin. Your program will flip a virtual coin that number of times and return the following: 1) The number of times heads occurred. 2) The number of times tails occured. Then take the coin flip program and modify the random number generator to roll a single 6-sided dice.   DO NOT DISPLAY THE RESULTS OF EACH ROLL. 1) Ask the user how...

  • For a given list ask user if he/she wants to create a new list that repeats...

    For a given list ask user if he/she wants to create a new list that repeats n‐times itself. If Yes‐ create a new list that repeats itself n‐times, (n is user specified). ask user(use list and while) Python

  • Write a program in visual c# program named CheckMonth that prompts a user to enter a...

    Write a program in visual c# program named CheckMonth that prompts a user to enter a birth month. If the value entered is greater than 12 or less than 1, display an error message; otherwise, display the valid month with a message such as 3 is a valid month.

  • IN PERL Write a program that will ask the user for a number and will print...

    IN PERL Write a program that will ask the user for a number and will print all the integers in order starting from 1 until the number. Use the <> operator to ask for the user's input. For this program you will write a countdown timer. Your time will count down from 1 minute (60 seconds) to 0. Once the timer gets to 0 seconds the system will display a message that reads: RING RING RING! -using do while-

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT