Author: admin
Home > Articles posted by admin (Page 139)
Question:When moving, ants form rows so that each ant except the first is behind another ant. It is not widely known what happens when two rows of ants moving in opposite directions run into each other in a passage too narrow for both rows to...
Question:Write a program to print out a calendar for a particular month given the day on which the first of the month occurs together with the number of days in the month.
Your program should take as input an integer representing the day of the week...
Question 1.
Use EasyGui to write a program to convert temperatures from Fahrenheit to Celsius. The formula for that is: Celsius = 5 / 9 * (Fahrenheit – 32). Use GUI input and output. You need to create a easygui enterbox to ask Fahrenheit, then use...
Posted at 01:50h
in
Uncategorized
by admin
Question 1:
Input a string and print the string 5 times
Sample program run
----------------------------
Enter a string: Apple
AppleAppleAppleAppleApple
Sample program run
----------------------------
Enter a string: Orange
OrangeOrangeOrangeOrangeOrange
Question 2:
Write a program to find the simple interest for an amount (P) for the rate (R ) and for the number of years (Y).
The formula...
Question:
You will be given two arrays A and B of positive integers. The number of values in both the arrays will be the same say N. Your task is to find the maximum sum of products of their elements. Each element in A has to...
Posted at 23:06h
in
Uncategorized
by admin
Question:
Input a number (N) , reverse a number and add the reversed number to the number. For e.g. given a number 23 you need to add 23 and 32 (which is the reverse of 23) is 55.
Below is the code to reverse a string in...
Question:
Count the number of cars passing each other on the street.
The goal is to count passing cars. We say that a pair of cars (P, Q), where 0 ≤ P < Q < N, is passing when car P is traveling to the east and car Q is traveling to the...
Posted at 18:25h
in
Uncategorized
by admin
Question 1:
A store is having a sale. They’re giving 10 percent off purchases of $10 or lower, and 20 percent off purchases of greater than $10. Write a program that asks the purchase price and displays the discount (10% or 20%) and the final price.
Sample Input...
Posted at 18:19h
in
Uncategorized
by admin
Question 1:(please use function that return a value)
Write a program to display information to a driver based on his/her speed according to the following table:
km/h over the limit
Fine
1 to 20
$100
21 to 30
$270
31 or above
$500
Sample Input 1:
Enter the speed limit: 40
Enter the recorded speed of the...
Posted at 18:15h
in
archives
by admin
Problem Description
You have been asked to take a small icon that appears on the screen of a smart telephone and scale it up so it looks bigger on a regular computer screen.
The icon will be encoded as characters (x and *) in a 3 ×...