Professional Documents
Culture Documents
SET-1 Simple C Programs.
SET-1 Simple C Programs.
1. Write a program to print Hello World on the screen. 2. Write a program to Program to read one number and display it. (With messages) 3. Write a program that will obtain the length and width o a rectangle rom user and calculate its area! perimeter and diagonal. ". #he straight line method o computing the yearly depreciation o the $alue o an item is gi$en by %epreciation& (Purchase Price'(al$age )alue)* +ears o (er$ice. Write a program to determine the sal$age $alue o an ,tem when the purchase price! years o ser$ice and the annual depreciation are gi$en -. .rea o a triangle is gi$en by the ormula .&s/rt(((('a)(('b)(('c)) Where a!b and c are sides o the triangle and 2(&a0b0c. Write a program to compute the area o the triangle gi$en the $alues o a!b and c . 1. Write a program to 2on$ert temperature in 2elsius to 3ahrenheit * 3ahrenheit to 2elsius. 3& (4*-) 52 0 32 6. Write a program to ind the sum o the digits o a 3'digit integer constant. 7. Write a program to interchange the $alues o two $ariables. 4. Write a program to .ssign $alue o one $ariable to another using post and pre increment operator and print the results. 18. Write a program to 9ead the price o item in decimal orm e.g. 12.-8. (eparate rupees and paisa rom the gi$en $alue e.g. 12 rupees and -8 paisa.
18D
-D
4. Write a program that will allow computer to be used as an ordinary calculator. 2onsider only common arithmetic operations.(0! '! 5! * ) #he program should display a menu showing the di erent options a$ailable. %o using i and also using switch statements. 18. #he cost o one type o mobile ser$ice is 9s. 2-8 plus 9s. 1.2or Fach call made o$er and abo$e 188 calls. Write a program to read 2ustomer codes and calls made and print the bill or each customer.
SET % : Write a C program for following Pattern.. 1 12 12! 12!% 1 22 !!! %%%%
1. 2. 3. ".
Write a program to ind number is odd or not. Write a program to ind out actorial o gi$en number using unction. Write a program to generate series >!>2!>3........>n Write a program to ind ma>imum o three numbers.
2.
3.
Write a program which de ine a structure that can describe a hotel. ,t should ha$e members that includes the name! address! grade! a$erage room charge and number o rooms. #he program should per orm ollowing operation 1) #o print out hotels o a gi$en grade in order o charges. 2) #o print out hotels with room charges less then the gi$en $alue
". Write a program to read student roll number!name and maths mar:s or 3 students and prints student name and rollno i the mar:s are e/ual on screen.
$ariables along with its $alue. and print its elements in re$erse order whether they are identical. order using pointers