ASCII Values-Introduction to Computer Programming-Assignment, Exercises of Computer Engineering and Programming

This assignment was given by Dr. Jyoti Lokesh at Biju Patnaik University of Technology, Rourkela for Computer Programming course. It includes: Character, Keyboard, Capital, Letter, ASCII, Program, Positive, Integer, Input, Data, List

Typology: Exercises

2011/2012

Uploaded on 07/13/2012

ekvir
ekvir 🇮🇳

4

(1)

35 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
MAJU | Computer Programming CS1123 |Spring 2012| Assignment
# 1
1
CO M P U T E R PR O G R A M M I N G
AS S I G N M E N T # 1
SUBMISSION DATE: 14-03-2012 SUBMISSION TIME: 1 PM
NOTE: Carefully read instructions given at the end of assignment before solving it.
1. Any character is entered through the keyboard. Write a program to determine whether
the character entered is a capital letter, a small letter, a digit or a special symbol.
The following table shows the range of ASCII values for various characters.
Characters
ASCII Values
A Z
65 90
a z
97 122
0 9
48 57
Special Symbols
0 47, 58 64, 91 96, 123 - 127
2. Write a program that asks the user to type strictly positive integer. When the user types
a negative value the program prints ERROR and asks for typing another value. When the
user types 0, which means that the last value has been typed and the program must
print the average of the strictly positive integers. If the number of typed values is zero
the program prints 'NO AVERAGE'.
3. Write a program that reads daily temperatures, as floats. Read in a loop until user
enters 999. After the input has been read, print the maximum and minimum values. You
can assume that there is at least one input data list. Sample input values: 10.0 11.3
4.5 -2.0 3.6 -3.3 0.0
The output should look something like the following. Formatting may vary.
Maximum = 11.3
Minimum = -3.3
Don’t take 999 as a temperature.
4. Write a program which will perform the following tasks:
Display a menu in main( ) which will show the following options:
a. Absolute
b. Remainder
c. Cube
d. ASCII Value
docsity.com
pf2

Partial preview of the text

Download ASCII Values-Introduction to Computer Programming-Assignment and more Exercises Computer Engineering and Programming in PDF only on Docsity!

MAJU | Computer Programming CS1123 |Spring 2012 | Assignment

1

1

C O M P U T E R P R O G R A M M I N G

A S S I G N M E N T # 1

SUBMISSION DATE: 14-03-2012 SUBMISSION TIME: 1 PM

NOTE: Carefully read instructions given at the end of assignment before solving it.

  1. Any character is entered through the keyboard. Write a program to determine whether the character entered is a capital letter, a small letter, a digit or a special symbol.

The following table shows the range of ASCII values for various characters.

Characters ASCII Values A – Z 65 – 90 a – z 97 – 122 0 – 9 48 – 57 Special Symbols 0 – 47, 58 – 64, 91 – 96, 123 - 127

  1. Write a program that asks the user to type strictly positive integer. When the user types a negative value the program prints ERROR and asks for typing another value. When the user types 0, which means that the last value has been typed and the program must print the average of the strictly positive integers. If the number of typed values is zero the program prints 'NO AVERAGE'.
  2. Write a program that reads daily temperatures, as floats. Read in a loop until user enters 999. After the input has been read, print the maximum and minimum values. You can assume that there is at least one input data list. Sample input values: 10.0 11. 4.5 -2.0 3.6 -3.3 0. The output should look something like the following. Formatting may vary. Maximum = 11. Minimum = -3. Don’t take 999 as a temperature.
    1. Write a program which will perform the following tasks:

Display a menu in main( ) which will show the following options: a. Absolute b. Remainder c. Cube d. ASCII Value

docsity.com

MAJU | Computer Programming CS1123 |Spring 2012 | Assignment

1

2

e. Maximum f. Minimum

Your task is to write switch case definitions for the above tasks. Use built-in functions. You have to use switch case for making the menu. The task of operation is given below:

Absolute: it will take a number from user and computes the absolute value.

Remainder: it will take two numbers from user and calculate the remainder when the greater number is divided with the smaller number and displays the result.

Cube: it will take a number from user and computes the cube of that number.

ASCII_Value: It will take a character from user and computes the ASCII value of the character.

Maximum: Function will take three numbers from user and computes the maximum number and displays the result.

Minimum: it will take three numbers from user and computes the minimum number and displays the result.

  1. Take a 5 digit number from user and display sum of the digits.

Sample Input Sample output 13414 Sum = 13 95411 Sum = 20

IMPORTANT INSTRUCTIONS:

  1. Read the problem carefully.
  2. For submission make a folder named your name and reg. no. for example amjad_BC093051 , paste all programs in it. File names of programs must be according to the question numbers.
  3. Submission date and time is fixed; it will not be extended in any case.
  4. Honest attempt of solving the assignment will be appreciated, therefore try to solve the assignment rather than copying it from your fellows.
  5. No compensation for copy cases and plagiarism. Strictly F grade will be awarded. - - - - - - - - - -GOOD LUCK - - - - - - - - - -

docsity.com