Answer:
Following is the program in c++ language
#include <iostream> // header file
using namespace std; // namespace
int maxSum(int ar[][10],int r) // function definition of maxsum
{
int s=0; // varaible declaration
for(int k=0;k<r;k++)// iterating the loop
{
int maximum=ar[k][0]; //finding the maximum value
for(int k2=0;k2<10;k2++)// iterating the loop
{
if(maximum<ar[k][k2]) // check the condition
{
maximum=ar[k][k2]; // storing the value in the maximum variable
}
}
s=s+maximum;//adding maximum value to the sum
}
return s; // return the sum
}
int main() // main function
{
int ar[][10]={{5,2,8,-8,9,9,8,-5,-1,-5},{4,1,8,0,10,7,6,1,8,-5}}; // initilaized array
cout<<"sum of maximum value:";
int t=maxSum(ar,2); // function calling
cout<<t; // display the maximum value
}
Output:
sum of maximum value:19
Explanation:
Following are the description of Program
access buffer
output buffer
transmission buffer
none of the above
Answer: Output buffer
Explanation:
Each packet switches contain multiple links which are attached to it and for individually attached link the output buffer basically store packets. Then, the router send these packets into multiple links.
In output buffer, if the packets are transmitted into the links but it finds that the link is busy with the another packet for transmission. Then, that particular packet needs to be wait in output buffer.
Therefore, the output buffer is the correct option.
Answer:
import java.util.Scanner;
public class PalindromeInteger {
public static void main(String[] args) {
// Create an object of the Scanner class to allow for user's inputs
Scanner input = new Scanner(System.in);
// Create a prompt to display the aim of the program.
System.out.println("Program to check whether or not a number is a palindrome");
// Prompt the user to enter an integer number.
System.out.println("Please enter an integer : ");
// Receive user's input and store in an int variable, number.
int number = input.nextInt();
// Then, call the isPalindrome() method to check if or not the
// number is a palindrome integer.
// Display the necessary output.
if (isPalindrome(number)) {
System.out.println(number + " is a palindrome integer");
}
else {
System.out.println(number + " is a not a palindrome integer");
}
}
// Method to return the reversal of an integer.
// It receives the integer as a parameter.
public static int reverse(int num) {
// First convert the number into a string as follows:
// Concatenate it with an empty quote.
// Store the result in a String variable, str.
String str = "" + num;
// Create and initialize a String variable to hold the reversal of the
// string str. i.e rev_str
String rev_str = "";
// Create a loop to cycle through each character in the string str,
// beginning at the last character down to the first character.
// At every cycle, append the character to the rev_str variable.
// At the end of the loop, rev_str will contain the reversed of str
for (int i = str.length() - 1; i >= 0; i--) {
rev_str += str.charAt(i);
}
// Convert the rev_str to an integer using the Integer.parseInt()
// method. Store the result in an integer variable reversed_num.
int reversed_num = Integer.parseInt(rev_str);
// Return the reversed_num
return reversed_num;
}
// Method to check whether or not a number is a palindrome integer.
// It takes in the number as parameter and returns a true or false.
// A number is a palindrome integer if reversing the number does not
// change the number itself.
public static boolean isPalindrome(int number) {
// check if the number is the same as its reversal by calling the
//reverse() method declared earlier. Return true if yes, otherwise,
// return false.
if (number == reverse(number)) {
return true;
}
return false;
}
}
Explanation:
The source code file for the program has also been attached to this response for readability. Please download the file and go through the comments in the code carefully as it explains every segment of the code.
Hope this helps!
Answer:
balance = float(input("Enter the current credit card balance: "))
purchases = float(input("Enter the amount of new purchases: "))
payments = float(input("Enter the amount of all payments: "))
unpaid = purchases - payments
if unpaid >= 0 and unpaid < 100:
balance = balance + payments - purchases - (unpaid * 0.08)
elif unpaid >= 100 and unpaid <= 500:
balance = balance + payments - purchases - (unpaid * 0.12)
else:
balance = balance + payments - purchases - (unpaid * 0.16)
print("The balance is " + str(balance))
Explanation:
*The code is in Python.
Ask the user to enter the balance, amount of purchases, and amount of payments
Calculate the unpaid balance, subtract payments from purchases
Check the unpaid balance. If it is smaller than 100, calculate the new balance, add payments, subtract purchases and the 8% interest of unpaid balance. If it is between 100 and 500, calculate the new balance, add payments, subtract purchases and the 12% interest of unpaid balance. If it is greater than 500, calculate the new balance, add payments, subtract purchases and the 16% interest of unpaid balance
Print the balance
Answer:
I am writing Python program.
string = input("Enter a string: ")
print(string.count(' '))
Explanation:
The first statement takes input string from the user.
input() is used to read the input from the user.
The next statement uses count() function to count the number of times the specified object which is space ' ' hereoccurs in the string.
The print() function is used to return the number of times the space occurs in the string entered by the user.
Output:
Enter a string: How are you doing today?
4
The screenshot of program and its output is attached.
A.22 % 2 > −3
B.22 % 2 < 5
C.22 % 2 == 4
D.22 % 2 != 1
This is for my python coding class thank you
Answer:
D. 22 % 2 != 1
Explanation:
Since 22 is even than it would have to stay 0.
Therefore, your only answer choice would be D.
Answer:
The answer is "In the given pseudo-code there are three errors".
Explanation:
The description of the errors can be defined as follows: