Posts

A Company is planning a big sale at which they will give their customers a special promotional discount. Each customer that purchases product from a company has a unique customerID number from 0 to N-1. Andy, the marketing head of all the company has selected bill amounts of N customers for promotional scheme .The discount will be given to customers whose fill amounts are perfect squares .The customers may use this discount on a future purchase.

  A Company is planning a big sale at which they will give their customers a special promotional discount. Each customer that purchases product from a company has a unique customerID number from 0 to N-1. Andy, the marketing head of all the company has selected bill amounts of N customers for promotional scheme .The discount will be given to customers whose fill amounts are perfect squares .The customers may use this discount on a future purchase. Write an algorithm to help Andy find the number of customers that will be given discounts.   Input: The first line of the input consists of an integer numOfCust,representing the number of customers whose bills are selected for the promotional discount(N). The second line contains of N space separated integers bill0,bill1....bill(n-1) representing the bill amounts of the N customers selected for promotional discount. Output: Print an integer representing the number of customers that will be given discounts. Example: ...

Peters Number Code solution in Java

  Peters Number solution in Java Imagine there is a person who likes numbers a lot and wants to choose a number that consists of n digits.But it has to be special. The person also wants it to have a sum of digits equal to s,which should be as large as possible .The number cannot have leading 0s.Can you help the person find that number or determine that it doesn’t exist. Input: The first line of input contains an integer n, representing the number of digits in the requested number ,The second line of input contains s,representing sum of digits   Output: Print the requested number if it exists or -1 otherwise   Example1: Input: 1 5 Output: 5 Example 2: Input: 2 15 Output 96 Code in Java   import java.util.Scanner;   public class Peterscode {        public static void main(String[] args ) {          // TODO Auto-generated method stub  ...