Você está na página 1de 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

check whether the given number is positive, negative or zero.

OWrite a program to find

the greatest number in three given numbers.

OWrite a program to find

out the second greatest number in three given numbers.

OCalculate the sum of two

numbers which are not greatest in three given numbers.

OPrint a Floyd's triangle

of star.
O *

** ***

OPrint a Pascal triangle

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

97 122 48 57 0 - 47, 58 - 64, 91 - 96,

special symbols 123 - 127

OWrite a program to

check whether the given year is leap year or not.

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)

OWrite a program to swap

two number using temporary variable.

OWrite a program to swap

two number without using temporary variable.

OWrite a program to

check whether the given number is prime or not.

OWrite a program to print

the Fibonacci series of 'n' user given no.of elements.

OWrite a program to find

out the reverse of the given number. (153 --> 351)

OWrite a program to find

out the given number is the palindrome or not. (4334)

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.

OWrite a program to find

the factorial value of any number entered through the keyboard.

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

generate all combinations of 1, 2 and 3 using for loop.

OPrint a numeric pyramid.

ARRAYS
OWrite a program to find

out the sum of the array.

OWrite a program to find

the greatest and the smallest element of the given array.

OWrite a program to sort

the array elements.

OWrite a program to

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

OWrite a program to swap

two 1D arrays.

OWrite a program to find

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.

OWrite a program to print

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!)

OWrite a menu driven

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

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

OWrite a program to

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

OWrite a program to ask for the username

and give them the same username as the password. Then ask them to check for the login by asking username and password. If they are valid give a welcome note. If not throw an error message.

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

check whether the given string is a palindrom or not.(Eg: Madam)

OWrite a program that

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

OWrite a program to

check whether the given character is present in a given string or not.

OWrite a program to print

every word of the string "Welcome to KGiSL" in new line.

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.

Você também pode gostar