2. Using the online compiler •
Enter the code
int main(int argc, char *argv[]) {
byte_t first_byte = 128;
byte_t second_byte = 1;
int shift;
printf("Enter the number of left/right shifts: ");
scanf("%d", &shift);
printf("\n\n");
// Right-shift first_byte
first_byte = first_byte >> shift;
// Left-shift second byte
// This is the equivalent of second_byte = second_byte << shift;
second_byte <<= shift;
// Display the results
printf("128 >> %d = %d\n", shift, first_byte);
printf("1 << %d = %d\n", shift, second_byte);
system("pause");
return 0;
}You will be prompted to enter a value for the number of shifts. Initially enter the value of zero
Repeat the previous two steps with values of 1, 2, 3, 4, 5, 6, 7 and 8
10. Using the online compiler
• Write a program using a for loop that counts upwards from 0 to 100 in steps of 2.
9. Using the online compiler
• Write a program that counts down from 100 to 0 using a for a loop.
8. Using the online compiler
• Write a program that counts upwards from 0 to 100 using a for a loop. •
7) Using the online compiler
Enter the code
int main(int argc, char *argv[]) {
int a, b;
// Obtain values for a and b
printf("Enter the value for integer a: ");
scanf("%d", &a);
printf("Enter the value for integer b: ");
scanf("%d", &b);
printf("\n\n");
// Compare a and b
if (a > b) // Testing for a greater than b
{
printf("a (%d) is bigger than b 0(%d)\n", a, b);
}
else if (a == b) // Testing for equality
{
printf("a (%d) is equal to b (%d)\n", a, b);
}
else // Otherwise a must be less than b
{
printf("a (%d) is less than b (%d)\n", a, b);
}
system("pause");
return 0;
}• Run the program (which uses for loops and arrays).
Instructions:
Instructions
Input
A line containing an integer.
10Output
Multiple lines containing an integer.
9
7
5
3
1Write a Javascript Program to Add,Delete employees in a payroll list.
1. The payroll program should input the following:
Employee Name Days Worked Daily Rate Deduction Amount
2. During Addition, the program should display the following in a table:
No. Employee Name Days Worked Daily Rate Gross Pay Deduction Amount Net Pay
where:
No. = is the Payroll List Line number
Gross Pay = Days Worked * Daily Rate
Net Pay = Gross Pay - Deduction Amount
3. During Deletion, the program should ask for the Line Number to delete and update the table
Write a Javascript Program (1 HTML File) that will input an integer value n and display (upon a button click) the following:
1. The nth factorial (Using a While Loop)
2. The sum of the first n numbers (Using a Do While Loop)
3. The Average of the first n numbers (Using a For Loop)
Input the Taxable Income and Compute the income tax using the following table:
*Note: Do not use prompts for user inputs. Use the HTML input tag.
over but not over Rate
--- 250,000 0%
250,000 400,000 20% of the excess over 250,000
400,000 800,000 30,000+25% of the excess over 400,000
800,000 2,000,000 130,000+30% of the excess over 800,000
2,000,000 8,000,000 490,000+32% of the excess over 2,000,000
8,000,000 ---- 2,410,000+35% of the excess over 8,000,000
Ex)
Taxable Income Income Tax
180,000 0
320,000 14,000
520,000 60,000
930,000 169,000
2,400,000 618,000
10,000,000 3,110,000
1. Can a program be correct and still not exhibit a good quality? Explain using or referencing a specific program as an example to support your answer
2.Is it possible to assess the quality of software if the customer keeps changing what it is supposed to do?