problems

2
Problems 1. Write a program that will input a lower case character from keyboard, convert the character into UPPER CASE and output into DOS screen. Do the same task 5 times. 2. Input a number from keyboard, check whether it is a negative or not. If it a negative number then convert the number into positive and output, again if it is positive number only then square the number and output the result. 3. Input unlimited number of numbers from keyboard until a negative number is input. Sum all the positive values, output the summation result. 4. From 1 to 100 square each of the even numbers and output the respective values. 5. If I type ‘A’ the program should say “You typed A”, If I type ‘B’ the program should say “You typed B” and so on up to ‘D’. If any other characters are typed program should say “Invalid Command !”. You can solve it using switch-case or if-elseif-else. 6. A two digit number is entered through keyboard and make the number reversed. After reversing the number check whether the numbers are equal or not. 7. Input a number through the keyboard decide whether it is a prime number or not. 8. Using a loop output all the prime number from 1 to 1000. 9. A company insures its drivers in the following cases: - If the driver is married. - If the driver is unmarried, male and above 30 years of age - If the driver is unmarried, female and above 25 years of age In all other cases the driver is not insured. If the marital status, sex and age of the driver are entered through the keyboard,

Upload: sm-akash

Post on 07-Nov-2015

2 views

Category:

Documents


0 download

DESCRIPTION

problemsss

TRANSCRIPT

Problems1. Write a program that will input a lower case character from keyboard, convert the character into UPPER CASE and output into DOS screen. Do the same task 5 times.2. Input a number from keyboard, check whether it is a negative or not. If it a negative number then convert the number into positive and output, again if it is positive number only then square the number and output the result.3. Input unlimited number of numbers from keyboard until a negative number is input. Sum all the positive values, output the summation result.4. From 1 to 100 square each of the even numbers and output the respective values.5. If I type A the program should say You typed A, If I type B the program should say You typed B and so on up to D. If any other characters are typed program should say Invalid Command !. You can solve it using switch-case or if-elseif-else.6. A two digit number is entered through keyboard and make the number reversed. After reversing the number check whether the numbers are equal or not.7. Input a number through the keyboard decide whether it is a prime number or not.8. Using a loop output all the prime number from 1 to 1000.9. A company insures its drivers in the following cases:- If the driver is married.- If the driver is unmarried, male and above 30 years of age- If the driver is unmarried, female and above 25 years of ageIn all other cases the driver is not insured. If the marital status, sex and age of the driver are entered through the keyboard, write a program to determine whether the driver is to be insured or not.