write ac program to print the type of triangle after taking all sides from the user.
Q: The manager of Mama Calari’s Pizza Palace wants a program that calculates and displays the number of…
A: The manager wants to calculate the number of pizza slices into which the pizza can be divided.…
Q: Aerospace engineers sometimes compute the trajectories of projectiles such as rockets. A related…
A:
Q: n Infix expression from the user and convert into postfix. 1. Should be self-organizing program…
A: It is defined as Infix notation: X + YOperators are written in-between their operands. This is the…
Q: Write a program that reads in three integers and then determines and prints the largest and the…
A: Program approach:- Using the necessary header file. Display 3 inputs with the largest input…
Q: .א א א * : xxxxxx x x xxxxx xxx xx x x xx Print x x x x x x x
A: "Since you have not mention any programming language, so will write this program in C language." C…
Q: Language: C++ Consider the abs function, which determines the absolute values of a real number. The…
A: #include<iostream> using namespace std; int abs(int a) { if (a<0) return…
Q: *x xx xxxx xxxx x x * xxxx *xxx x x x x x
A: As there is no programming language mentioned so program is attempted in c++ no of rows =10 pattern…
Q: Write a program that finds the sum, difference, and product of 2 given numbers.
A: Given: To write code in C++.
Q: Swapping to numbers. We have to write a program to swap two numbers using +, - operator only and…
A: program to swap two numbers using +, - operator only and print the results both conditions:
Q: What is the correct output from the following program?
A: Program: // Include Header file #include <iostream> using namespace std; // Main function int…
Q: Write an expression that returns a random integer between 34 and 55, inclusively.
A: EXPLANATION - Random Function - To return random number between any two number a function is…
Q: Write a program to take 3 side of a triangle from user and you have to find the area of triangle in…
A: Requirements:- Write a program to take 3 sides of a triangle from the user and you have to find the…
Q: import javax.swing.*; import java.awt. *; public class MyProgram {//begin of class public static…
A: in your code using JFrame, there are two buttons are added to display in container inside JFrame.…
Q: program that takes an integer as the number of minutes and outputs the total hours and minutes (90…
A: Given 90 minutes = 1 hour 30 minutes To do the given program.
Q: Write a program that asks the user to type 2 integers A and B and exchange the value of A and B.
A: Integer variables are variables that must take an integer value
Q: Write a program that reads an integer and determines and prints whetherit’s odd or even. [Hint: Use…
A: C++ Program for above : #include <iostream> using namespace std; int main() { //read…
Q: Write a program that take 5 digit number as an input from the user and perform the following tasks:…
A: Given: We are given a problem where we have to perform some operations on digits of the numbers…
Q: In a triangle, the sum of the lengths of any two sides is greater than the length of the other third…
A: Question- #include <iostream>#include<cmath> using namespace std; string…
Q: In order to discourage excess electric consumption, an electrical company charges its customers a…
A: Here is the approach : Print to the user and ask for the input of the kilowatt hours. Take the…
Q: Write a program that reads in two integers and determines and prints whetherthe first is a multiple…
A: C++ Program for above : #include <iostream> using namespace std; int main() { //read…
Q: Write a program that reads in two integers and determines and prints if the first is a multiple of…
A: Note: As no programming langauge is mentioned, therefore answering in python language. Input : Two…
Q: Fill in the blanks in the given code such that it prints the variable I only if i is less than 6.
A: Complete the given JAVA code to print the variable i in the output only if the value of i is less…
Q: Write a detailed code for Sum of Natural Numbers Using for..Loop in go lang programming language…
A: Here I have created a variable to store the sum of 50 natural numbers. Next, I have created a for…
Q: Question: Consider the following series: 1,1,2,3,4,9, 8, 27, 16, 81, 32, 243,64,729, 128,2187...…
A: Editable source code: #include <stdio.h>#include<math.h> int main() {//codeint…
Q: Write a C program that has two functions- main and sort • The sort function accepts three integers…
A: Code: #include <stdio.h>//function prototype for sortvoid sort(int, int, int);//main…
Q: Aerospace engineers sometimes compute the trajectories of projectiles such as rockets. A related…
A: newton.m function [ root ] = newton( f, df, x0, epsilon, max_iter )%function, derivative,initial…
![write ac program to print the type of
triangle after taking all sides from the
user.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fd16b217c-e839-4df8-af7a-b975ec694a82%2F4d0fe564-f515-4ff2-bf28-db9805adcb0e%2F1fnzec_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 4 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
- Write a function called has_duplicates that takes a string parameter and returns True if the string has any repeated characters. Otherwise, it should return False. Implement has_duplicates by creating a histogram using the histogram function above. Do not use any of the implementations of has_duplicates that are given in your textbook. Instead, your implementation should use the counts in the histogram to decide if there are any duplicates. Write a loop over the strings in the provided test_dups list. Print each string in the list and whether or not it has any duplicates based on the return value of has_duplicates for that string. For example, the output for "aaa" and "abc" would be the following. aaa has duplicatesabc has no duplicates Print a line like one of the above for each of the strings in test_dups. test_dups = ["zzz","dog","bookkeeper","subdermatoglyphic","subdermatoglyphics"]You can check whether a string is a substring of another string by using the find method in the str class. Write your own function to implementfind. Write a program that prompts the user to enter two strings and then checks whether the first string is a substring of the second string.Bartleby answered my homework and Write a function called has_duplicates that takes a string parameter and returns True if the string has any repeated characters. Otherwise, it should return False. Implement has_duplicates by creating a histogram using the histogram function above. Do not use any of the implementations of has_duplicates that are given in your textbook. Instead, your implementation should use the counts in the histogram to decide if there are any duplicates. Write a loop over the strings in the provided test_dups list. Print each string in the list and whether or not it has any duplicates based on the return value of has_duplicates for that string. For example, the output for "aaa" and "abc" would be the following. aaa has duplicatesabc has no duplicates Print a line like one of the above for each of the strings in test_dups. True needs to be defined. I tried to code it but didn't accept and got an error message.
- Write a Program to take two strings from the user and find the common string in both of them. Try to give the very optimised approach, I know the brute force approach and try on two different test case. You can use Java as programming language.uestion 42: Return whether a string consists of a single letter In the function below, return True if the input string parameter consists of a single uppercase letter; otherwise, return False. Most solutions would do this in two logical steps: first testing if the string consists of a single character and, second, testing whether that character is one of the uppercase letters (which can be done by seeing if it is alphabetically between A and Z, inclusive).Could you solve this Question please? Write a function called has_duplicates that takes a string parameter and returns True if the string has any repeated characters. Otherwise, it should return False. Implement has_duplicates by creating a histogram using the histogram function above. Do not use any of the implementations of has_duplicates that are given in your textbook. Instead, your implementation should use the counts in the histogram to decide if there are any duplicates. Write a loop over the strings in the provided test_dups list. Print each string in the list and whether or not it has any duplicates based on the return value of has_duplicates for that string. For example, the output for "aaa" and "abc" would be the following. aaa has duplicatesabc has no duplicates Print a line like one of the above for each of the strings in test_dups. Obs:Copy the code below into your program def histogram(s): d = dict() for c in s: if c not in d: d[c] =…
- A kidnapper kidnaps you and writes a ransom note. He does not write it by hand to avoid having his hand writing being recognized, so he uses a magazine to create a ransom note. We need to find out, given the ransom string and magazine string, is it possible to create a given ransom note. The kidnapper can use individual characters of words. Here is how your program should work to simulate the ransom problem: ▪ your program should prompt the user to enter a long String to represent the magazine and another short String to represent the required ransom note. ▪ your program needs to check if the magazine string contains all required characters in equal or greater number present in the ransom note. ▪ your program should print true if it is possible to create the given ransom note from the given magazine, and print false otherwise. ▪ Break up your code into a set of well-defined functions. Each function should include a comment block that briefly describes it, its parameters and…Write a program that does two string functions: capitalize the first word of a phrase, and reverse the letters of words in odd positions within the phrase. For this program it is acceptable to let punctuation be part of the word. Write a capitalizeWords() and a reverseOddWords() method and call them in a test program. Make certain to properly handle empty phrases, phrases with one and two words, and phrases with greater than two words. For example, if the original phrase were: Learning Java is fun! Java is powerful and easy to use The capitalized version would be: Learning Java Is Fun! Java Is Powerful And Easy To Use And with reversed odd words would be: gninraeL Java sI Fun! avaJ Is lufrewoP And ysaE To esUThe program will ask the user for their name and employee ID. The ID will be a five-digit number. This will be done in a single function, AskNameId, with bool return, where the name and id are passed as pointers. Read both variables as strings with a getline and convert the id to an int using atoi. Check that the id is not 0. If it is, cout a message to the user for entering an invalid id. Check if the name is an empty string. If it is, cout a message to the user for entering an invalid name. Return a bool, true if name and id are both valid and false if either one is not valid.
- Using your code from the previous question, write a program that reads a multi-line message up to the first full stop and then modifies the contents of the message, so that all whitespace characters are removed. Finally,it should print out the modified message using a single printf statement. If the user types: A simple sentence. the program should output Asimplesentence. For the purposes of this question, a whitespace character is either a space, a tab or a newline. Note in particular that the sentence might be spread over several lines. For example: Input Result A simple sentence. Asimplesentence. A sentence with a newline. Asentencewithanewline. Code i was given: #include <stdio.h>#include <stdbool.h>#define MAX_MSG_LEN 256 int main(void){ int i = 0; char msg[MAX_MSG_LEN+1]; /* insert appropriate variable declarations */ /* read the message from the concole up to first full stop */ /* loop through the message and keep only non-whitespace…You are given a string. Get input from the user. In the first line, print the third character of this string. In the second line, print the second to last character of this string. In the third line, print the first five characters of this string. In the fourth line, print all but the last two characters of this string. In the fifth line, print all the characters of this string with even indices (remember indexing starts at 0, so the characters are displayed starting with the first). In the sixth line, print all the characters of this string with odd indices (i.e. starting with the second character in the string). In the seventh line, print all the characters of the string in reverse order. 8. In the eighth line, print every second character of the string in reverse order, starting from the last one. In the ninth line, print the length of the given string.please do in Haskal programing and explain how it is done ?
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)