Home
Diploma Practice C Online People
Certificate Contact Us

Assignments on Arrays and Loops


1. Define an array of 5 int variables. Ask user to enter 5 numbers.
   Read five numbers into this array of five. Finally print these 5 numbers.

2. Read five numbers from the user into an array of 5. Calculate the smallest
   number, largest number, total and average. Finally print these calculated
   values.

3. Define an array of 6 char variables. Ask the user to enter the marks of
   6 subjects. Read these marks into the array. As each mark is from 0 to 100,
   it can be stored in 8 bit integer, that is char variable.
   Print whether the student is passed or failed. Take pass mark as 35.

4. Read a a line of string from the user. Find the length of the string and
   print.

5. Read a line from the user and print the number of capital letters present
   in the string.

6. Read a line from the user and print the number of spaces present in the
   line.

7. Read a line and print the number of words present in the line string.
   Note that one or more spaces could be present between the wokds. 

8. Read a line from the user, and convert each capital letter to small letter
   and small letter to capital. All the other characters should remain as
   it is. Finally print the modified line string.

9. Define two strings, each of size 80 chars. Read a line string into 
   first string. Copy this first string into the second one. Print the
   second string.

10. Define a string of size 80 chars. Also define 5 strings of size 20 chars
    each. Ask the user to enter a line containg 5 words. Copy each word
    into individual strings. Finally print all the inidividual string.





#401, Sai Sushma Homes, 23/A, S.R. Nagar Main Road, Hyderabad-500038, India.
Ph: +91-40-48508764, 7702028989, depik.help@gmail.com