Programming Assignments

Similar documents
I PUC - Computer Science. Practical s Syllabus. Contents

Key Topics What will ALL students learn? What will the most able students learn?

Math 0980 Chapter Objectives. Chapter 1: Introduction to Algebra: The Integers.

Everyday Mathematics CCSS EDITION CCSS EDITION. Content Strand: Number and Numeration

Everyday Mathematics GOALS

MATHCOUNTS TOOLBOX Facts, Formulas and Tricks

Number Sense and Operations

MATHEMATICAL LITERACY LESSON PLANS.

Charlesworth School Year Group Maths Targets

CAMI Education linked to CAPS: Mathematics

Factoring Polynomials

PES Institute of Technology-BSC QUESTION BANK

MACM 101 Discrete Mathematics I

MATHS LEVEL DESCRIPTORS

Bridging Documents for Mathematics

Scope and Sequence KA KB 1A 1B 2A 2B 3A 3B 4A 4B 5A 5B 6A 6B

Numeracy Targets. I can count at least 20 objects

6.4 Special Factoring Rules

Cubes and Cube Roots

WORK SCHEDULE: MATHEMATICS 2007

NEW MEXICO Grade 6 MATHEMATICS STANDARDS

numerical place value additional topics rounding off numbers power of numbers negative numbers addition with materials fundamentals

ModuMath Basic Math Basic Math Naming Whole Numbers Basic Math The Number Line Basic Math Addition of Whole Numbers, Part I

CCSS Mathematics Implementation Guide Grade First Nine Weeks

LINEAR INEQUALITIES. Mathematics is the art of saying many things in many different ways. MAXWELL

My Year 1 Maths Targets

Mathematics standards

Pre-Algebra Academic Content Standards Grade Eight Ohio. Number, Number Sense and Operations Standard. Number and Number Systems

MENSURATION. Definition

Prentice Hall Connected Mathematics 2, 7th Grade Units 2009

Math 5th grade. Create your own number and explain how to use expanded form to show place value to the ten millions place.

of surface, , , of triangle, 548 Associative Property of addition, 12, 331 of multiplication, 18, 433

10CS35: Data Structures Using C

Algebra Academic Content Standards Grade Eight and Grade Nine Ohio. Grade Eight. Number, Number Sense and Operations Standard

ALGEBRA. sequence, term, nth term, consecutive, rule, relationship, generate, predict, continue increase, decrease finite, infinite

ML for the Working Programmer

B.Sc.(Computer Science) and. B.Sc.(IT) Effective From July 2011

SPECIAL PRODUCTS AND FACTORS

Grade 5 Math Content 1

Mathematics Scope and Sequence, K-8

Filling and Wrapping: Homework Examples from ACE

1.3 Polynomials and Factoring

GRADES 7, 8, AND 9 BIG IDEAS

Algebra I Vocabulary Cards

Everyday Mathematics. Grade 4 Grade-Level Goals CCSS EDITION. Content Strand: Number and Numeration. Program Goal Content Thread Grade-Level Goal

FACTORS AND MULTIPLES Answer Key

Data Structure [Question Bank]

Chapter 4 -- Decimals

Math 10C: Numbers, Radicals, and Exponents PRACTICE EXAM

Math Review. for the Quantitative Reasoning Measure of the GRE revised General Test

SAT Subject Math Level 2 Facts & Formulas

Copy in your notebook: Add an example of each term with the symbols used in algebra 2 if there are any.

Factoring Polynomials

Unit Write iterative and recursive C functions to find the greatest common divisor of two integers. [6]

AP Computer Science Java Mr. Clausen Program 9A, 9B

CS177 MIDTERM 2 PRACTICE EXAM SOLUTION. Name: Student ID:

How To Solve Factoring Problems

Section 6.1 Factoring Expressions

SQUARE-SQUARE ROOT AND CUBE-CUBE ROOT

FOREWORD. Executive Secretary

SAT Math Facts & Formulas Review Quiz

SA B 1 p where is the slant height of the pyramid. V 1 3 Bh. 3D Solids Pyramids and Cones. Surface Area and Volume of a Pyramid

Platonic Solids. Some solids have curved surfaces or a mix of curved and flat surfaces (so they aren't polyhedra). Examples:

3D shapes. Level A. 1. Which of the following is a 3-D shape? A) Cylinder B) Octagon C) Kite. 2. What is another name for 3-D shapes?

Such As Statements, Kindergarten Grade 8

MATH 90 CHAPTER 6 Name:.

Level 1 - Maths Targets TARGETS. With support, I can show my work using objects or pictures 12. I can order numbers to 10 3

ISAT Mathematics Performance Definitions Grade 4

MATHEMATICAL INDUCTION. Mathematical Induction. This is a powerful method to prove properties of positive integers.

Chapter 111. Texas Essential Knowledge and Skills for Mathematics. Subchapter B. Middle School

2014 Chapter Competition Solutions

Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void

Primary Curriculum 2014

Standards and progression point examples

Homework until Test #2

Everyday Mathematics. Grade 4 Grade-Level Goals. 3rd Edition. Content Strand: Number and Numeration. Program Goal Content Thread Grade-Level Goals

Algebra II. Administered May 2013 RELEASED

Sample Questions Csci 1112 A. Bellaachia

Overview. Essential Questions. Grade 8 Mathematics, Quarter 4, Unit 4.3 Finding Volume of Cones, Cylinders, and Spheres

CSU Fresno Problem Solving Session. Geometry, 17 March 2012

7 Relations and Functions

Illinois State Standards Alignments Grades Three through Eleven

Formulas and Problem Solving

Tennessee Mathematics Standards Implementation. Grade Six Mathematics. Standard 1 Mathematical Processes

Factoring and Applications

Square Roots and Other Radicals

Solutions to Homework 10

Perimeter, Area, and Volume

A Second Course in Mathematics Concepts for Elementary Teachers: Theory, Problems, and Solutions

Georgia Standards of Excellence Curriculum Map. Mathematics. GSE 8 th Grade

boxes Stock cubes food and drink are packed in If you had to design a box which would hold 36 stock cubes which cuboid would you choose?

SURFACE AREAS AND VOLUMES

Get post program 7 W.a.p. that Enter two numbers from user and do arithmetic operation

Elementary Number Theory and Methods of Proof. CSE 215, Foundations of Computer Science Stony Brook University

Pennsylvania System of School Assessment

LESSON 4 Missing Numbers in Multiplication Missing Numbers in Division LESSON 5 Order of Operations, Part 1 LESSON 6 Fractional Parts LESSON 7 Lines,

Activity Set 4. Trainer Guide

Mathematics K 6 continuum of key ideas

9 Control Statements. 9.1 Introduction. 9.2 Objectives. 9.3 Statements

Transcription:

Programming Assignments 1. A number is called an Armstrong number if the sum of the cubes of the digits of the number is equal to the number. For example 153 = 1^3 + 5^3 + 3^3. Write a C program that asks the user to enter a number and returns if it is Armstrong or not (use function). 2. Write a program in C that takes as input a set of numbers and calculates the mean, variance and standard deviation. (variance is defined as Σ [(xi - x )^2]/n - 1, where xi =i th number in the set, x is the mean and n=cardinality of the set ; standard deviation is the square root of variance). 3. Write a C program that calculates the HCF and LCM of two numbers. 4. Write a C program to display and find the sum of the series 1+11+111+...111 upto n. For eg. if n=4, the series is : 1+11+111+1111. Take the value of 'n' as input from the user. 5. Write a C program that reads a positive integer n and then prints the following pattern ********* _******** ******* ****** ***** **** *** ** * where n is the number of lines. 6. Amicable numbers are found in pairs. A given pair of numbers is Amicable if the sum of the proper divisors (not including itself) of one number is equal to the other number and vice versa. For example 220 & 284 are amicable numbers First we find the proper divisors of 220: 220:1, 2, 4, 5, 10, 11, 20, 22, 44, 55, 110 1+ 2 + 4 + 5 + 10 + 11 + 20 + 22 + 44 + 55 + 110 = 284 Now, 284: 1, 2, 4, 71, 142 1 + 2 + 4 + 71 + 142 = 220 Write a C program to check that the input pair of numbers is amicable. 7. Write a C function for the following problem: Given a positive integer n, print the binary representation of n. 8. A triangular number is one which can be represented by that number of pebbles in a symmetric triangle. The first five triangular numbers are 1, 3, 6, 10 and 15. Write a C function int istriangular(int n) to test if a number n is triangular or not. It should return 1 if it is triangular and 0 if not. T1=1 T2=3 T3=6 T4=10 T5=15 9. Write a C program to find the reverse of an integer number.

10. Write a C program to sort an array of integers using bubble sort. 11. Write a C program to input n numbers in an array, calculate the sum of all even numbers and all odd numbers in the array and print the larger sum. If the array contains the following elements: 2, 3, 3, 5, 4, 8, 7, 11, 2 The sum of all even elements is 2+4+8+2=16 Sum of all odd elements is 3+3+5+7+11=29 Therefore, the output should be 29. 12. Take the price and quantity of items as an input. Write a C function to calculate the sum of the prices. Write another C function to calculate the discount according to the following rules: For total less than Rs.1000, discount is 5%. For total greater than Rs.1000 but less than Rs.5000, discount is 10%. For total greater than Rs.5000, discount is 15%. Write another function to print the individual item prices, total, discount and the final price. If the prices are as follows: Item 1: 200 Item 2: 400 Item 3: 200 Item 4: 10 Item 5: 50 And the quantities are: Item 1: 1 Item 2: 1 Item 3: 3 Item 4: 5 Item 5: 2 Then you should print: Item Price Quantity Subtotal Item 1 200 1 200 Item 2 400 1 400 Item 3 200 3 600 Item 4 10 5 50 Item 5 50 2 100 ------------------------------------------------- TOTAL 1350 Discount 10% -135 ------------------------------------------------- GRAND TOTAL 1215

13. Write a C program to calculate the volume of the following shapes: Cube, Cuboid, Sphere, Cylinder and Cone. Ask the user which one s/he wants to calculate, and take the appropriate required inputs. Then print the result. The input should be taken in the main function and calculations for every solid should be done in a separate function by passing appropriate arguments. If the user chooses the option for cube, only one input is required i.e., the side. The volume is then calculated and printed. If the user chooses the option for cuboid, only three inputs are required i.e., length, breadth and height. The volume is then calculated and printed. 14.Write a C program to check if a number has three consecutive 5s. If yes, print YES, else print NO. Number: 1353554 Result: NO Number: 345559 Result: YES 15. Write a C program to print the following pattern: a) 1 b) 1 1 2 2 2 1 2 3 3 3 3 1 2 3 4 4 4 4 4 12 3 4 5 5 5 5 5 5 16. Write a C program to accept 10 values in an integer array. Display the number of odd, even, and negative numbers. 17. Write a C program to accept the basic salary of an employee from the user. Calculate the gross salary on the following basis: Basic HRA DA 1-4000 10% 50% 4001-8000 20% 60% 8001-12000 25% 70% 12000 and above 30% 80% 18. Write a C function celsius() to convert degrees Fahrenheit to degrees Celsius. (The conversion formula is C = 5/9 * ( F - 32).) Use it to print a Fahrenheit-to-Centigrade table for -40 to 220 degrees Fahrenheit, in increments of 10 degrees. (Remember that %f is the printf format to use for printing floating-point numbers. Also, remember that the integer expression 5/9 gives 0, so you won't want to use integer division.) 19. An Electricity board charges the following rates for use of electricity. For the First 200 units : Rs 1 per unit For the next 100 units : Rs 1.5 per unit

Beyond 300 units : Rs 2 Per unit. Write a C Program to read no of unit consumed and print out total charge amount. 20. Write a C program, which will print two digit numbers whose sum of both digit is multiple of seven. e.g. 16,25,34... 21. Write a C program, That reads list of n integer and print sum of product of consecutive numbers. if n=7 and numbers are 4,5,2,5,6,4,7 then output is 4*5+5*2+2*5+5*6+6*4+4*7 = 122. 22. Write a C program that take 2 integer sets A[] and b[] as input and prints results of following set operations: i. A union B (Write function set_union()) ii. A intersection B (Write function set_intersection()) iii. A-B and B-A (Write function set_difference()) 23. Write a C program to take a list of n elements from the user. Store it in an array. Reverse the list. 24. Write a C program to check whether a given string is palindrome or not. 25. Write 2 different C functions to compute area and perimeter of a triangle whose sides a, b, and c are given by user as inputs. Formula to compute perimeter = a + b + c Formula to compute area = [s(s-a)(s-b)(s-c)]0.5 Where s = 0.5 * (a+b+c) Function prototypes are: double perim(double a, double b, double c) double area(double a, double b, double c) Your program should read the input data and print the output data via separate functions. The prototypes are: double read_input() double print_value(double val) use math.h and compile with -lm flag 26. Input size and values in two arrays A and B, of max size 100. Then, compute A[i]+B[i] and store in array C. And compute A[i]*B[i] and store in array D. 27. Compute taxes for a given income with tax slab rates as follows... slab 1... 0-2500: 0% slab 2... 2500-5000: 10%

slab 3... 5000-10000: 20% slab 4... 10000+: 30% (for each range of a given income, the tax rate is different) e.g. input: x = 5200 divisions are 0-2500, 2500-5000, 5000-5200 calculation: 0-2500 of x: 0% of 2500 = 0 2500-5000 of x: 10% of 2500 = 250 5000-1000 of x: 20% of 200 = 40 output: 290 28. Input date, month and year from the user, and using switch case, display in worded format. e.g. input: d=16, m=7, y=1992 output: 16th July, 1992 29. Find out the ugly prime number Desc: The given number is ugly prime number if it's prime factor contains only among 2,3 or 5. e.g. 20= 2*2*5 is ugly prime number 14=2*7 is not a ugly prime number So write a C function which takes values from 1 to n and returns the number of ugly primes number in it. input: 20 output: 3 30. Implement bubble sort, Insertion sort, binary search in C