LOOPS
Let diff = the absolute value of (num – guess). If diff is 0, then guess is correct. diff is not 0. Then the program outputs the message as follows:
1. If diff is greater than or equal to 50, the program outputs the message indicating that the guess is very high (if guess is greater than num) or very low (if guess is less than num).
2. If diff is greater than or equal to 30 and less than 50, the program outputs the message indicating that the guess is high (if guess is greater than num) or low (if guess is less than num).
3. If diff is greater than or equal to 15 and less than 30, the program outputs the message indicating that the guess is moderately high (if guess is greater than num) or moderately low (if guess is less than num).
4. If diff is greater than 0 and less than 15, the program outputs the message indicating that the guess is somewhat high (if guess is greater than num) or somewhat low (if guess is less than num).
Give the user no more than five tries to guess the number.
BY LOOPS
Write a program that ask the user to type a value and check whether it is prime or not.
Write a C++ program that prints on the screen following diamond shape with given series of numbers.
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19
20 21 22
23 24
25
Pls help me with thissss..
Create a C++ program based on the requirements below:
After get a grade from the user, the program will determine what will be the corresponding grade equivalent.
Conversion Table
101 and higher - Out of Range
90 to 100 - Excellent
80 to 89 - Very Good
75 to 79 - Good
74 and below - Failed
Sample Output:
Enter Grade: 79
The equivalent of 79 is Good!
Write a program that can able to print the following pattern:
*
***
*****
*******
*********
1.Write a Java program that calculates and prints the monthly pay for an employee. The net pay is calculated after taking the following deductions:
Witholding 15%
SSS contribution 3.63%
Medicare 1.25%
Pag-IBIG PHP 100.00
2.Initialize two (2) variables to hold the employee name and the gross pay (amount before deductions). See sample output below:
Employee Name: Jess Diaz
Gross Pay: 25000.0
Deductions Amount
Witholding Tax 3750.0
SSS Contributions: 907.5
Medicare: 312.5
Pagibig Contribution: 100.0
Net Pay: 19930.0
Instructions:
Create a variable that accepts a positive integer.
Create an empty list. Then, using loops, add string values to your list using the input() function. The number of string values to be added are dependent on the inputted value on the first inputted integer.
Create another variable that accepts a non-negative integer. The number must only range from 0 until the value of the first inputted integer.
Using your understanding on accessing list elements, access and print out the list element having the index position of the second inputted integer.
Input
The first line contains an integer n which is the size of the array.
The next n lines contains a string on each.
The last line contains an integer which is the index to be accessed and printed.
6
Learning
Programming
made
easy
with
Cody!
5
Output
A line containing a string.
Cody!
Using two examples each, explain the difference between cyber technical vulnerabilities and people‐related vulnerabilities.
void fun()
{
static int i=10;
print ("%d", ++i);
}
int main ()
{
fun ();
fun();
}
3.3. Write a program that produces the given sequence numbers (in alternate arrangement and reverse order using the three looping statements: 5, 1, 4, 2, 3, 3, 2, 4, 1, 5,
1st Solution – using for loop
2nd Solution – using while loop
3rd Solution-‐ using do while