B.Tech. (I) - ICP-132 (2008) Assignment 2 Level 0 ------- 1. Read two integers and print numbers from the lower integer to the higher Input: 10 6 Output: 6 7 8 9 10 2. Read 'n' real numbers and print the maximum. First input is 'n'. Eg Input: 5 1.0 10.2 2.4 -4.2 2.5 Output: 10.2 3. Find average of 'n' numbers. Input: 3 0.7 0.3 2.5 Output: 1.1667 Level 1 ------- 1. Read integer 'n' and a string 's' print 's' n-times. Input: 4 sda Output: sdasdasdasda 2. Given a string print the number of letters in between 'X' and 'Y'. Print -ve if 'Y' comes earlier to 'X'. Input: abXabcdeY Output: 5 3. Print the first 'n' numbers in Fibonocci series. Given: Fib(n)=Fib(n-1)+Fib(n-2); Fib(0)=0; Fib(1)=1 Input: 10 Output: 0 1 1 2 3 5 8 13 21 34 Level 2 ------- 1. Find standard deviation of 'n' numbers. (Normalise by N-1) Input: 3 0.7 0.3 2.5 Output: 1.179 2. Given a string, print ASCII values of each letter. Input: AbC Output: 65 98 67 3. Given a string, find the mod 10 of sum of all ASCII values. Input: AB Output: 1 Level 3 ------- Read http://acm.uva.es/problemset/float-in-competition.pdf 1. Fix the bug in the following program: --- #include using namespace std; int main() { float D; D=0.1; while ( 1.0-D != 0.0 ) { cout << D << endl; D=D+0.1; } return 0; } --- 2. Write a program that correctly prints the shorter of the two paths, AOB and COD, where O is the origin; points A, B, C and D are successively (2, 5, 31), (1,2,9), (0, 7, 27) and (1,8,10). 3. Given 'n' strings, print them in dictionary order. Input: 4 who knows? hello world a I am the best! :) Output: I am the best! :) a hello world who knows?