How To Write A C Program To Print A Given Number On A Computer (For A Computer)

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

10CS35: Data Structures Using C

ALLIED PAPER : DISCRETE MATHEMATICS (for B.Sc. Computer Technology & B.Sc. Multimedia and Web Technology)

1. Define: (a) Variable, (b) Constant, (c) Type, (d) Enumerated Type, (e) Identifier.

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

Bangalore University B.Sc Computer Science Syllabus ( Semester System)

ML for the Working Programmer

Pseudo code Tutorial and Exercises Teacher s Version

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

Sample Questions Csci 1112 A. Bellaachia

Learning Guide Overview and Resources

Solution for Homework 2

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

PES Institute of Technology-BSC QUESTION BANK

Symbol Tables. Introduction

Syllabus for Computer Science. Proposed scheme for B.Sc Programme under Choice Based Credit System

Objected oriented Programming: C++ Unit 1 1. Introduction 1.1. Introduction to Object Oriented Programming C++ fundamentals.

BCS2B02: OOP Concepts and Data Structures Using C++

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement?

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

Data Structure [Question Bank]

MACM 101 Discrete Mathematics I

Anchorage School District/Alaska Sr. High Math Performance Standards Algebra

Data Structure and Algorithm I Midterm Examination 120 points Time: 9:10am-12:10pm (180 minutes), Friday, November 12, 2010

1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++

Functions Recursion. C++ functions. Declare/prototype. Define. Call. int myfunction (int ); int myfunction (int x){ int y = x*x; return y; }

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

MATHCOUNTS TOOLBOX Facts, Formulas and Tricks

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

HOMEWORK # 2 SOLUTIO

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

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

Number Sense and Operations

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

PROBLEMS (Cap. 4 - Istruzioni macchina)

MATH BOOK OF PROBLEMS SERIES. New from Pearson Custom Publishing!

UNIVERSITY OF MUMBAI. Revised syllabus for F.Y.BSc. Computer Science to be implemented. from

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)

Pennsylvania System of School Assessment

NCPC 2013 Presentation of solutions

Check Digits for Detecting Recording Errors in Horticultural Research: Theory and Examples

MATH 095, College Prep Mathematics: Unit Coverage Pre-algebra topics (arithmetic skills) offered through BSE (Basic Skills Education)

5: Magnitude 6: Convert to Polar 7: Convert to Rectangular

Systems I: Computer Organization and Architecture

The string of digits in the binary number system represents the quantity

PROGRAMMING IN C PROGRAMMING IN C CONTENT AT A GLANCE

Grade 6 Mathematics Performance Level Descriptors

DATA STRUCTURES USING C

Informatica e Sistemi in Tempo Reale

Unit 6. Loop statements

How do you compare numbers? On a number line, larger numbers are to the right and smaller numbers are to the left.

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

Mental Math Tricks and More

Common Core Standards for Fantasy Sports Worksheets. Page 1

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING LESSON PLAN

Continued Fractions and the Euclidean Algorithm

1 Classical Universal Computer 3

Vocabulary Words and Definitions for Algebra

International Indian School, Riyadh SA1 Worksheet Class: VI Mathematics

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

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

Factoring Algorithms

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

CSC4510 AUTOMATA 2.1 Finite Automata: Examples and D efinitions Definitions

Higher Education Math Placement

Grade 7 & 8 Math Circles October 19, 2011 Prime Numbers

The Tower of Hanoi. Recursion Solution. Recursive Function. Time Complexity. Recursive Thinking. Why Recursion? n! = n* (n-1)!

COMPUTER SCIENCE. Paper 1 (THEORY)

This is great when speed is important and relatively few words are necessary, but Max would be a terrible language for writing a text editor.

Number Representation

Thnkwell s Homeschool Precalculus Course Lesson Plan: 36 weeks

Mathematics Scope and Sequence, K-8

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Florida Math Correlation of the ALEKS course Florida Math 0028 to the Florida Mathematics Competencies - Upper

Algebra 1 Course Title

New Hash Function Construction for Textual and Geometric Data Retrieval

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

Polynomial Degree and Finite Differences

Calculator Notes for the TI-Nspire and TI-Nspire CAS

LSN 2 Number Systems. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology

2011, The McGraw-Hill Companies, Inc. Chapter 3

Data Storage. Chapter 3. Objectives. 3-1 Data Types. Data Inside the Computer. After studying this chapter, students should be able to:

Chapter 1. Computation theory

Python Lists and Loops

Primes. Name Period Number Theory

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

Curriculum Map. Discipline: Computer Science Course: C++

n 2 + 4n + 3. The answer in decimal form (for the Blitz): 0, 75. Solution. (n + 1)(n + 3) = n lim m 2 1

26 Integers: Multiplication, Division, and Order

Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8

Factoring Algorithms

GUJARAT TECHNOLOGICAL UNIVERSITY, AHMEDABAD, GUJARAT. Course Curriculum. DATA STRUCTURES (Code: )

SECTION C [short essay] [Not to exceed 120 words, Answer any SIX questions. Each question carries FOUR marks] 6 x 4=24 marks

Excel 2003 Tutorials - Video File Attributes

Expression. Variable Equation Polynomial Monomial Add. Area. Volume Surface Space Length Width. Probability. Chance Random Likely Possibility Odds

KEANSBURG SCHOOL DISTRICT KEANSBURG HIGH SCHOOL Mathematics Department. HSPA 10 Curriculum. September 2007

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

Microsoft Excel Tips & Tricks

Everyday Mathematics GOALS

Transcription:

MLR Institute of Technology DUNDIGAL 500 043, HYDERABAD COMPUTER SCIENCE AND ENGINEERING Computer Programming Lab List of Experiments S.No. Program Category List of Programs 1 Operators a) Write a C program that takes two operands and one operator from the user, performs the operation and then prints the answer (Consider operators +, -, *, and %). b) Write a C program to find the area and volume of sphere. Formulas are: Area = 4*PI*R*R Volume = 4/3*PI*R*R*R. c) Write a C program to find out whether the character pressed through the keyboard is a digit or not (using conditional operator). d) Write a C program to print logic 1 if input character is capital otherwise 0. e) Write a C program to display 1 if input number is between 1 to 100 otherwise 0 by using the logical AND operator. f) Write a C program to shift the input data by two bits right. g) Write a C program to swap the values of two variables with/without using a third variable. h) Write a C program to add the individual digits of a 3-digit number by % and / operator. 2 Control Statements a) Write a C program to to print the given 3 integers in ascending order using if-else. b) Write a C program to calculate commission for the input value of sales amount. Commission is calculated as per the following rules: Commission is nil for sales amount Rs 5000/. Commission is 2% for sales when sales amount is greater than 5000 and less than equal to 10000. Commission is 5% for sales amount greater than 10000. c) A character is entered through keyboard. Write a C program to determine whether the character entered is a capital letter, a small case letter, a digit or a special symbol using if-else and switch case. The following table shows the range of ASCII values for various characters. Characters ASCII values A Z 65 90

a z 97 122 0 9 48 57 Special symbols 0 47, 58 64, 91 96, 123-127 d) Write a C program to examine a character entered from the keyboard is a lowercase letter or upper case, digit, punctuation mark or a space character. e) Write a C program to read a 3 digit number from keyboard and print it vertically using if-else. f) Write a C program to check whether a given 3 digit number is Armstrong number or not using if-else. g) Write a C program to read a week day number (0 to 6) and print the day name. h) Write a C program to provide multiple functions such as ADD, SUB, MUL, DIV and MOD using switch case. i) If cost price and selling price of an item s input through the keyboard, write a program to determine whether the seller has made profit or incurred loss. Write a C program to determine how much profit or loss incurred in percentage. j) Write a C program to find Sum of individual digits of a positive integer. k) Write a C program to generate to generate the first n terms of the Fibonacci sequence. l) Write a C program to generate all the prime numbers between 1 and n, where n is a value supplied by the user. m) Write a C program to check the given number is perfect number or not. n) Write a C program to print the factors of a given number. o) Write a C program to calculate the following sum, Sum=1 + x2/2! + X4/4! up to given n terms. p) Write a C program to find the roots of a quadratic equation. q) Write a C program to generate Pascal s triangle. r) Write a C program to find the GCD and LCM of two numbers. s) The total distance traveled by vehicle in t seconds is given by distance=ut+1/2at2 where u and a are the Initial velocity (m/sec) and acceleration (m/sec2). Write a C program to find the distance traveled at regular intervals of time given values of u and a. The program should provide the flexibility to the user to select his own time intervals and repeat the calculations for different values of u and a. t) Write a C program to find the largest and smallest number in a list of integers. u) Write a C program to read in two numbers, x and n, and then compute the sum of this geometric progression 1+x+x2+x3+...xn. For example: if n is 3 and x is 5, then the

program computes 1+5+25+125. Print x, n, the sum. Perform error checking. For example the formula does not make sense for negative Exponents if n is less than 0. Have your program print an error message if n<0, then go back and read in the nest pair of numbers of without computing the sum. Are any values of x also illegal? If so, test for them too. v) Write a C program to print the numbers in triangular form 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 w) Write a C program to find friendly numbers between 1 to n. x) Write a C program to print the perfect squares between 1 to 100. y) Write a C program to print the following series 1/1! + 2/2! + 3/3! + z) Write a C program to generate all combinations of 1, 2 and 3 numbers using for loop. 3 Functions a) Write a C program to find the factorial of a given number using non-recursive and recursive function. b) Write a C program to find the GCD (greatest common divisor) of two given integers using non-recursive and recursive function. c) Write a C program to Convert decimal number to binary number Convert Binary number to decimal number Using non recursive functions. d) Write a C program to print your name using recursion. e) Write a C program to print Fibonacci series using recursion. f) Write a C program to solve Towers of Hanoi problem using recursive function. g) Write a C program to print the transpose of a given matrix using function. h) Write a C program that will print the longest word written in a line using function. i) Write a C program that uses a function to search a number within an array. j) Write a C program that uses a function to scan a string that is passed as an argument and convert all characters to capital letters. k) Write a C program that uses a function to reverse a given string and use it to check whether the given string is a palindrome or not.

4 Arrays a) Write a C program to find minimum, maximum, sum and average of the given one dimensional array. b) Write a C program to print the alphabets A Z along with their ASCII values using array. c) Write a C program to store numbers into an array and find the frequency of a particular number in array and print it. d) Write a C program to count and display positive, negative, odd and even numbers in an array. e) Write a C program to find the largest and smallest number in a list of integers. f) Write a C program to swap the K th and (K+1) th elements in an integer array. K is given by the user. g) Write a C program to merge two sorted arrays into another array in a sorted order. h) Write a C program to print the individual digits of a number using array. i) Write a C program to print the binary equivalent of a given decimal number using array. j) Write a C program to search a given element n present in the array or not. k) Write a C program to sort the array elements in ascending order using bubble sort technique. l) Write a C program to convert a Roman letter into its decimal equivalent. m) Write a C program to find 2 s complement of a binary number. n) Write a C program to read a matrix of size mxn and print it. o) Write a C program that uses functions to perform the following Addition of two Matrices Multiplication of two Matrices 5 Pointers a) Write a C program to add two numbers using pointers. b) Write a C program to swap two numbers using pointers. c) Write a C program to find the length of string using pointers. d) Write a C program to compare two strings using pointers. e) Write a C program to copy a string from source to destination using pointers. f) Write a C program to reverse a string using pointers. 6 Strings a) Write a C program to find the length of a given string. b) Write a C program to count the number of vowels in a given string and also print the vowels. c) White a C program to check how many alphabets and non alphabets are there in a string. d) Write a C program to remove blank spaces from a string. e) Write a C program to capitalize all the letters of a string. f) Write a C program that uses functions to perform the following

operations To insert a sub-string in to given main string from a given position. To delete n characters from a given position in given string. g) Write a C program to determine if the given string is a palindrome or not. h) Write a C program that displays the position or index in the string S where the string T begins or 1 if S does not contain T. i) Write a C program to count the lines, words and characters in a given text. j) Write a C program that deletes a word from a sentence. Note that the word may appear any number of times. k) Write a C program to find a string within a sentence and replace it with another string. l) Write a C program that takes the name of a person as input and prints the name in an abbreviated fashion, e.g. Ram Kumar as R. K. m) Write a C program that reads a line of text and counts all occurrence of a particular word. n) Write a C program to convert each character of a string into the next alphabet and print the string. 7 Structures and Unions a) Write a C program to copy one structure to another of same type. b) Write a C program that passes a pointer to a structure and returns nothing. c) Write a C program to define a structure named time, which contains three int members. d) Write a C program to create a structure containing 5 strings: address1, address2, city, state and zip. Create a typedef called record that can be used to create instances of this structure. e) Write a C program that uses functions to perform the following operations Reading a complex number Writing a complex number Addition of 2 complex numbers Multiplication of 2 complex numbers 8 Files a) Write a C program to copy the contents from one file to another. b) Write a C program to display the contents of a file on screen. c) Write a C program to count the number of characters and number of lines in a file. d) Write a C program that accepts the names of two files. It

should copy the first file into the second line by line. Use the fgets() and fputs() functions. e) Write a C program to delete a file using remove() function. f) Write a C program to rename the old file name to new file name using rename(). g) Write a C program to reverse the first n characters in a file. (Note: the file name and n are specified on the command line) h) Write a C program to find the no. of characters, no. of words, and number of lines in a given file.