Write in C:
1.) Write an if/else statement that adds 1 to the variable minors if the variable age is less than 18, adds 1 to the variable adults if age is 18 through 64, and adds 1 to the variable seniors if age is 65 or older.
2.) Write a statement that compares the values of score1 and score2 and takes the following actions. When score1 exceeds score2, the message "player1 wins" is printed to standard out. When score2 exceeds score1, the message "player2 wins" is printed to standard out. In each case, the variablesplayer1Wins,, player1Losses, player2Wins, and player2Losses,, are incremented when appropriate.
Finally, in the event of a tie, the message "tie" is printed and the variable tieCount is incremented.
1.solution
#include
int main()
{
int minors=0,adults=0,seniors=0,n;
printf("Enter a number\t");
scanf("%d",&n);
if(n>=0 && n<18) //age between 0 to
18
{
minors=minors+1;
}
else if(n>=18 && n<=64) // age from 18
to 64
{
adults=adults+1;
}
else if(n>=65) // age 65 or above
{
seniors=seniors+1;
}
else // if negative values enter then this message
will be displayed
{
printf("enter correct age");
}
printf("%d\t%d\t%d\t",minors,adults,seniors); //
printing the values of variables
2.solution
#include
int main()
{
int
score1,score2,player1Wins=0,player1Losses=0,player2Wins=0,player2Losses=0,tie=0;
printf("enter score1\t");
scanf("%d",&score1);
printf("enter score2\t");
scanf("%d",&score2);
if(score1>score2) // player1 score is greater than
player2 score
{
player1Wins=player1Wins+1;
player2Losses=player2Losses+1;
printf("player1 wins");
}
else if(score2>score1) // player2 score is greater
than player1 score
{
player2Wins=player2Wins;
player1Losses=player1Losses;
printf("player2 wins");
}
else if(score1==score2) // both player1 and player2
scores are equal
{
tie=tie+1;
printf("tie");
}
}
Write in C: 1.) Write an if/else statement that adds 1 to the variable minors if...
Write an if/else statement that adds 1 to minors if age is less than 18, adds 1 to adults if age is 18 through 64 and adds 1 to seniors if age is 65 or older.
This is Visual Basics... Write an if/else statement that assigns true to the variable fever if the variable temperature is greater than 98.6; otherwise it assigns false to fever.* Write an if/else statement that adds 1 to the variable minors if the variable age is less than 18, adds 1 to the variable adults if age is 18 through 64 and adds 1 to the variable seniors if age is 65 or older.*
Use only C++ languages, please!!! Assume: int age; int minors = 0; int adults = 0; int seniors = 0; Write an if/else statement that adds 1 to the variable minors if the variable age is less than 18, adds 1 to the variable adults if age is 18 through 64 inclusive, and adds 1 to the variable seniors if age is 65 or older.
Python Write if/else code that adds one to the variable adults if the value of age is greater or equal to 18, and adds one to the variable minors otherwise.
1. Write an INSERT statement that adds this row to the Categories table: CategoryName: Brass Code the INSERT statement so SQL Server automatically generates the value for the CategoryID column. 2. Write an UPDATE statement that modifies the row you just added to the Categories table. This statement should change the Category Name column to “Woodwinds”, and it should use the CategoryID column to identify the row. 3.Write an INSERT statement that adds this row to the Products table: ProductID:...
Write a C# program that allows one user to play Rock-Paper-Scissors with computer. The user will pick a move (Rock Paper Scissors) from 3 radio buttons and click the play button to play the game. The application will use random number generator to pick a move for the computer. Then, the application display the computer's move and also display whether you won or lost the game, or the game is tie if both moves are the same. The application must...
C++ Program 1 – Write a program that determines if a person is an adult. Declare a string variable, firstName. Declare an integer variable, age. Asks the user to enter their first name, and store it in the firstName variable. Asks the user to enter their age in years, and store it in the age variable. If the age is greater or equal to 18, the print out their name and “you are an adult” Else print out their name...
anslate Assume that number is an int variable that has already been initialized. Write a statement that prints out the value of number in a field of 10 positions (right-justified within that field). Hint: Assume #include <iomanip> is included in the program. В І ЦА HTML Editor I 5 7 7 7 7 x x = = 1:12pt Paragraf O words 18 ctv A
4. Write an if/else statement in ternary format that compares the value of two int variables, firstNum and secondNum, and sets the value of an int variable minValue appropriately as follows: minValue should be the minimum of firstNum and secondNum. 5. Assume that Person is a predefined class and that the declaration Person[] people; has already been performed. Then the instruction People = new Person [200]; Reserves memory space for(Circle the answer): Option 1: a single Person object Option 2:...
Python My ITlab: 1. Write some code that repeatedly reads a value into the variable n until a number between 1 and 10 (inclusive) has been entered. 2. Write some code that repeatedly reads a value from standard input into the variable response until at last a Y or y or N or n has been entered. 3.Write a loop that reads positive integers from standard input, printing out those values that are greater than 100, each on a separate...