Sie sind auf Seite 1von 61

# Programs

KGiSL - iTech 1

## OWrite a program to print

odd number series and even number series based on the user given number.

OWrite a program to

of star.
O *

** ***

of star.
O *

* * * * *

## OIf cost price and selling price of

an item is input through the keyboard, write a program to determine whether the seller has made profit or incurred loss. Also determine how much profit he made or loss he incurred.

## OWrite a program to check

whether a triangle is valid or not, when the three angles of the triangle are entered through the keyboard.

## OGiven the length and

breadth of a rectangle, write a program to find whether the area of the rectangle is greater than its perimeter.

## OAny character is entered through

the keyboard, write a program to determine whether the character entered is a capital letter, a small case letter, a digit or a special symbol.

Characters AZ az 09 65 90

ASCII Values

## special symbols 123 - 127

OWrite a program to

## OA library charges a fine for every book

returned late. For first 5 days the fine is 50 paise, for 6-10 days fine is one rupee and above 10 days fine is 5 rupees. If you return the book after 30 days your membership will be cancelled. Write a program to accept the number of days the member is late to return the book and display the fine or the appropriate message.

## OIf the three sides of a

triangle are entered through the keyboard, write a program to check whether the triangle is valid or not. The triangle is valid if the sum of two sides is greater than the largest of the three sides.

## OPrint the numbers 1 - 10

in reverse order.

## OAccept any number from

1 - 10 and print the numbers from 1 - 10 other than the user given number.(using continue)

## two number without using temporary variable.

OWrite a program to

## OConsider the following

number 45*45=2025; 20+25=45.Write a program to generate number between 32 and 99 that satisfies the above property.

## OWrite a C program to find a

two digit number, the second digit of which is smaller than its first digit by 4, and if the number was divided by the digits sum, the quotient would be 7.

## OWrite a program to calculate

overtime pay of 3 employees. Overtime is paid at the rate of Rs. 12.00 per hour for every hour worked above 40 hours.

## OTwo numbers are entered

through the keyboard. Write a program to find the value of one number raised to the power of another.

## OWrite a program to print out all

Armstrong numbers between 1 and 500. If sum of cubes of each digit of the number is equal to the number itself, then the number is called an Armstrong number. For example, 153 = ( 1 * 1*1)+(5*5*5)+(3*3*3)

## OWrite a program to print

all prime numbers from 1 to 300. (Hint: Use nested loops, break and continue)

## OWrite a program to print

the multiplication table of the number entered by the user. The table should get displayed in the following form.
O29 * 1 = 29 O29 * 2 = 58

## OWrite a program to enter the

numbers till the user wants and at the end it should display the count of positive, negative and zeros entered.

OWrite a program to

## OPrint a numeric pyramid.

ARRAYS
OWrite a program to find

## the array elements.

OWrite a program to

check whether the given array elements are in Arithmetic Progression or not.

two 1D arrays.

## out the sum of diagonal elements of the given 2D array.

OWrite a program to

## search for the given element in an array.

OWrite a program to

## multiply a user given number with the given matrix.

OWrite a program to do a

matrix multiplication.

## the transpose of the given matrix.

Functions
OWrite a program to find

out the factorial for the user given number.(5! =5x4x3x2x1 i.e 5!=5x4!)

program for addition, subtraction, multiplication and division of two given numbers using function. The main() should have function calls only.

OWrite a program to

accept the student name and three marks from the user and calculate the total, average and grade using functions.

## OWrite a program to check whether

the given number is an Amstrong number or not. 153 =>No.of its digits is 3 => 1^3 + 5^3 + 3^3 = 1+125+27 = 153(same as the given number)

## OWrite a program to find out

the given number is an Adam number or not. 12 square(12)=144 reverse(144)=441 square root(441)=21reverse(21)=1 2(same as the given number)

Strings
OWrite a program to

welcome the user if their username and the password are of same size.

OWrite a program to

OWrite a program to

welcome the user until they give the same username and the password.

## OWrite a program to ask for the

Student No and the Dept name and the password. Password should be in the format of Student No@Dept(Eg: 101@ece). If it is valid give a welcome note. If not ask them whether they wish to try again or not. If they wish provide the needs. If not terminate the program after saying an end note.

OWrite a program to

## converts a string like "124" to an integer 124.

OWrite a program to

## OWrite a program to the

find out number of capital letters, small letters, spaces and special characters in a given string.

OWrite a program to

convert a uppercase string into lowercase and lowercase string into uppercase.