SHARDAYATAN -E.M STD-10 C-PROGRAMS

Size: px
Start display at page:

Download "SHARDAYATAN -E.M STD-10 C-PROGRAMS"

Transcription

1 PROGRAM -1 //PROGRAM TO DISPLAY YOUR SCHOOL NAME, ADDRESS int main() printf("\n ***************************"); printf("\n * SHARDAYATAN SCHOOL *"); printf("\n * OPP. LAKEVIEW GARDEN, *"); printf("\n * PIPLOD, SURAT *"); printf("\n ***************************"); return 0; PROGRAM -2 PROGRAM TO DISPLAY FIRST LETTER OF YOUR NAME printf("\n ********"); printf("\n *"); printf("\n ******"); printf("\n *"); printf("\n *"); printf("\n *"); PROGRAM 3 //PROGRAM TO DISPLAY AREA AND CIRCUMFERENCE OF CIRCLE. #define PI 3.14 float r, area, cir; printf("\n Enter radius of circle = "); scanf("%f", &r); area=pi*r*r; cir=2*pi*r; printf("\n Area of circle = %.2f", area); printf("\n Circumference of circle = %.2f", cir); PROGRAM 4 //PROGRAM TO DISPLAY AREA AND PERIMETER OF RECTANGLE float l,b,area,peri; printf("\n Enter length of rectable = "); PAGE - 1

2 scanf("%f", &l); printf("\n Enter breadth of rectable = "); scanf("%f", &b); area=l*b; peri=2*(l+b); printf("\n Area of rectangle = %.2f", area); printf("\n Perimeter of rectangle = %.2f", peri); SHARDAYATAN -E.M PROGRAM 5 //PROGRAM TO DISPLAY AREA AND PERIMETER OF SQUARE float l, area, peri; printf("\n Enter length of square = "); scanf("%f", &l); area=l*l; peri=4*l; printf("\n Area of square = %.2f", area); printf("\n Perimeter of square = %.2f", peri); PROGRAM-6 //PROGRAM TO DISPLAY VOLUME OF CUBOID float l,b,h,vol; printf("\n Enter length of cuboid = "); scanf("%f", &l); printf("\n Enter breadth of cuboid = "); scanf("%f", &b); printf("\n Enter height of cuboid = "); scanf("%f", &h); vol=l*b*h; printf("\n Volume of cuboid = %.2f", vol); PROGRAM-7 //PROGRAM TO FIND VOLUME OF SPHERE #define PI 3.14 float r,vol; printf("\n Enter radius of sphere = "); PAGE - 2

3 scanf("%f", &r); vol=(4.0/3.0)*pi*r*r*r; printf("\n Volume of sphere = %.2f", vol); SHARDAYATAN -E.M PROGRAM-8 //PROGRAM TO FIND VOLUME OF CYLINDER #define PI 3.14 float r,h,vol; printf("\n Enter radius of cylinder = "); scanf("%f", &r); printf("\n Enter height of cylinder = "); scanf("%f", &h); vol=pi*r*r*h; printf("\n Volume of cylinder is %.2f", vol); PROGRAM-9 //PROGRAM TO FIND SIMPLE INTEREST float p,r,n,si; printf("\n Enter principal amount = "); scanf("%f", &p); printf("\n Enter rate of interest = "); scanf("%f", &r); printf("\n Enter no. of year = "); scanf("%f", &n); si=(p*r*n)/100; printf("\n Simple interest = %.2f", si); PROGRAM-10 //PROGRAM TO CONVERT METER INTO MILIMETER float mt,mm; printf("\n Enter meter = "); scanf("%f", &mt); mm=mt*1000; printf("\n %.2f meter = %.2f milimeter",mt,mm); PAGE - 3

4 PROGRAM-11 //PROGRAM TO CONVERT FAHREINHEIT INTO CELCIUS float f,c; printf("\n Enter fahreinheit = "); scanf("%f", &f); c=(f-32)*5.0/9.0; printf("\n %.2f fahreinheit = %.2f celcius", f,c); PROGRAM-12 //PROGRAM TO FIND AVERAGE OF FIVE SUBJECTS float maths,sci,guj,comp,eng,avg; printf("\n Enter mark of maths = "); scanf("%f", &maths); printf("\n Enter mark of sci = "); scanf("%f", &guj); printf("\n Enter mark of comp = "); scanf("%f", &comp); printf("\n Enter mark of eng = "); scanf("%f", &eng); avg=(maths+sci+guj+comp+eng)/5; printf("\n Average of five subject is %.2f", avg); PROGRAM-13 //PROGRAM TO FIND WHETHER A GIVEN NO IS DIVISIBLE BY ANOTHER NUMBER OR NOT int n1,n2; printf("\n Enter n1 = "); scanf("%d", &n1); printf("\n Enter n2 = "); scanf("%d", &n2); if(n1%n2==0) printf("\n %d is divisible by %d ", n1,n2); else printf("\n %d is not divisible by %d ", n1,n2); PAGE - 4

5 PROGRAM-14 //PROGRAM TO FIND STUDENT IS PASS OR FAIL float maths,sci,eng,guj,comp; printf("\n Enter mark of maths = "); scanf("%f", &maths); printf("\n Enter mark of sci = "); scanf("%f", &sci); printf("\n Enter mark of eng = "); scanf("%f", &eng); printf("\n Enter mark of guj = "); scanf("%f", &guj); printf("\n Enter mark of comp = "); scanf("%f", &comp); if(maths >=35 && sci>=35 && eng>=35 && guj>=35 && comp>=35) printf("\n U R pass"); else printf("\n U R Fail"); PROGRAM-15 //PROGRAM TO FIND PERSON IS ELIGIBLE FOR VOTING OR NOT int age; printf("\n Enter your age = "); scanf("%d", &age); if(age>=18) printf("\n U R eligible for voting"); else printf("\n U R not eligible for voting"); PROGRAM-16 //PROGRAM TO FIND ADDITION, SUBTRACTION AND MULTIPLICATION USING SWITCH float n1,n2,result; int choice; printf("\n 1. Addition \n 2. Subtraction \n 3. Multiplication "); printf("\n Enter your choice = "); scanf("%d",&choice); printf("\n Enter value of n1 = "); PAGE - 5

6 scanf("%f", &n1); printf("\n Enter value of n2 = "); scanf("%f", &n2); switch(choice) case 1: result=n1+n2; printf("\n Addition of %.2f and %.2f is %.2f", n1,n2,result); break; case 2: result=n1-n2; printf("\n Subtraction of %.2f and %.2f is %.2f", n1,n2,result); break; case 3: result=n1*n2; printf("\n Multiplication of %.2f and %.2f is %.2f", n1,n2,result); break; default: printf("\n Invalid choice..."); PROGRAM-17 //PROGRAM FOR ADDITION, SUBTRACTION AND DIVISION USING ELSE-IF LADDER float n1,n2,result; int choice; printf("\n 1. Addition \n 2. Subtraction \n 3. Multiplication "); printf("\n Enter your choice = "); scanf("%d", &choice); printf("\n Enter value of n1 = "); scanf("%f", &n1); printf("\n Enter value of n2 = "); scanf("%f", &n2); if(choice==1) printf("\n Addition of %.2f and %.2f is %.2f", n1,n2,n1+n2); else if(choice==2) printf("\n Subtraction of %.2f and %.2f is %.2f",n1,n2,n1-n2); else if(choice==3) printf("\n Multiplication of %.2f and %.2f is %.2f", n1,n2,n1*n2); else printf("\n Invalid choice..."); PROGRAM-18 //program of array for theory only (THIS PROGRAM IS ONLY FOR THEORY) PAGE - 6

7 int mark[5],i; printf("\n Enter values... of array"); for(i=0;i<5;i++) printf("\n Enter value of mark[%d] = ",i); scanf("%d", &mark[i]); printf("\n U have entered array elements as below..."); for(i=0;i<5;i++) printf("\n mark[%d] = %d", i, mark[i]); printf("\n Address of mark[%d] = %u", i, &mark[i]); PROGRAM-19 //program to print series using for loop int n1,n2,i; printf("\n Enter number 1 = "); scanf("%d", &n1); printf("\n Enter number 2 = "); scanf("%d", &n2); for(i=n1;i<=n2;i++) printf("\n %d", i); PROGRAM-20 //program to print series using while loop int n1,n2,i; printf("\n Enter number 1 = "); scanf("%d",&n1); printf("\n Enter number 2 = "); scanf("%d",&n2); i=n1; while(i<=n2) printf("\n %d ", i); i++; PAGE - 7

8 PROGRAM-21 //program to print series using do-while loop int n1,n2,i; printf("\n Enter number 1 = "); scanf("%d", &n1); printf("\n Enter number 2 = "); scanf("%d", &n2); i=n1; do printf("\n %d", i); i++; while(i<=n2); PROGRAM-22 //program to print odd numbers between given numbers int n1,n2,i; printf("\n Enter number 1 = "); scanf("%d", &n1); printf("\n Enter number 2 = "); scanf("%d", &n2); for(i=n1;i<=n2;i++) if(i%2!=0) printf("\n %d ", i); PROGRAM-23 //program to print table of given number int i,no; printf("\n Enter number for table = "); scanf("%d", &no); for(i=1;i<=10;i++) printf("\n %d x %d = %d", no,i,no*i); PAGE - 8

9 PROGRAM 24 //program of addition(function with return type and with arguments) int n1,n2,res; int add(int,int); //function declaration printf("\n Enter number 1 = "); scanf("%d", &n1); printf("\n Enter number 2 = "); scanf("%d", &n2); res=add(n1,n2); //function call printf("\n Addition of %d and %d is %d", n1,n2,res); int add(int x, int y) //function definition return(x+y); PROGRAM 25 //program to illustrate use of function which return no value void print_line(); //function declaration print_line(); //function call printf("welcome to the world of C function "); print_line(); //function call void print_line() //function definition printf("================================="); PROGRAM 26 //program to illustrate use of function with argument and no return value void cube(int); //function declaration int number; printf("enter your number = "); scanf("%d", &number); cube(number); //function call void cube (int num1) //function definition printf("\n the cube of entered number is = %d", num1*num1*num1); PAGE - 9

10 PROGRAM 27 //program to illustrate use of function with argument and return value int sqr(int); //function declaration int number, result; printf("\n Enter your number = "); scanf("%d", &number); result=sqr(number); //function call printf("\n the square of %d is %d", number,result); int sqr(int num1) //function definition int answer; answer=num1*num1; return(answer); PAGE - 10

INDEX. Sl. No. Programs Page No. Procedure 2. 1 To check whether person is eligible for vote or not. 2 To find the given number is even or odd 6-8

INDEX. Sl. No. Programs Page No. Procedure 2. 1 To check whether person is eligible for vote or not. 2 To find the given number is even or odd 6-8 INDEX Sl. No. Programs Page No. Procedure 2 1 To check whether person is eligible for vote or not 3-5 2 To find the given number is even or odd 6-8 3 To find the given year is leap year or not 9-11 4 To

More information

The Hyderabad Public School, Begumpet, Hyderabad, A.P

The Hyderabad Public School, Begumpet, Hyderabad, A.P The Hyderabad Public School, Begumpet, Hyderabad, A.P. 500 016 2012-13 Department of Computer Science Class 8 Worksheet 3 1) How many times will the following statement execute? ( ) int a=5; while(a>6)

More information

1. Look carefully at the program shown below and answer the questions that follow.

1. Look carefully at the program shown below and answer the questions that follow. 1. Look carefully at the program shown below and answer the questions that follow. a. What is the name of the class of this program? BillClass b. Identify one variable that holds a String. item c. What

More information

Structured programming

Structured programming Exercises 2 Version 1.0, 22 September, 2016 Table of Contents 1. Simple C program structure................................................... 1 2. C Functions..................................................................

More information

Decision Making and Branching

Decision Making and Branching INTRODUCTION Decision Making and Branching Unit 4 In the previous lessons we have learned about the programming structure, data types, declaration of variables, tokens, constants, keywords and operators

More information

Test Paper 3 Programming Language Solution Question 1: Briefly describe the structure of a C program. A C program consists of (i) functions and (ii) statements There should be at least one function called

More information

PROGRAMMING IN C AND C++:

PROGRAMMING IN C AND C++: PROGRAMMING IN C AND C++: Week 1 1. Introductions 2. Using Dos commands, make a directory: C:\users\YearOfJoining\Sectionx\USERNAME\CS101 3. Getting started with Visual C++. 4. Write a program to print

More information

PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE

PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE 1. Write a C program to perform addition, subtraction, multiplication and division of two numbers. # include # include int a, b,sum,

More information

'C' Programming Language

'C' Programming Language F.Y. Diploma : Sem. II [DE/EJ/ET/EN/EX] 'C' Programming Language Time: 3 Hrs.] Prelim Question Paper Solution [Marks : 70 Q.1 Attempt any FIVE of the following : [10] Q.1(a) Define pointer. Write syntax

More information

Programming and Data Structures

Programming and Data Structures Programming and Data Structures Teacher: Sudeshna Sarkar sudeshna@cse.iitkgp.ernet.in Department of Computer Science and Engineering Indian Institute of Technology Kharagpur #include int main()

More information

Slides adopted from T. Ferguson Spring 2016

Slides adopted from T. Ferguson Spring 2016 CSE1311 Introduction to Programming for Science & Engineering Students Mostafa Parchami, Ph.D. Dept. of Comp. Science and Eng., Univ. of Texas at Arlington, USA Slides adopted from T. Ferguson Spring 2016

More information

Fundamentals of Programming

Fundamentals of Programming Fundamentals of Programming Lecture 3 - Constants, Variables, Data Types, And Operations Lecturer : Ebrahim Jahandar Borrowed from lecturer notes by Omid Jafarinezhad Outline C Program Data types Variables

More information

Fundamental of Programming (C)

Fundamental of Programming (C) Borrowed from lecturer notes by Omid Jafarinezhad Fundamental of Programming (C) Lecturer: Vahid Khodabakhshi Lecture 3 Constants, Variables, Data Types, And Operations Department of Computer Engineering

More information

1. Basics 1. Write a program to add any two-given integer. Algorithm Code 2. Write a program to calculate the volume of a given sphere Formula Code

1. Basics 1. Write a program to add any two-given integer. Algorithm Code  2. Write a program to calculate the volume of a given sphere Formula Code 1. Basics 1. Write a program to add any two-given integer. Algorithm - 1. Start 2. Prompt user for two integer values 3. Accept the two values a & b 4. Calculate c = a + b 5. Display c 6. Stop int a, b,

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model answer and the answer written by candidate

More information

Algorithms 4. Odd or even Algorithm 5. Greatest among three numbers Algorithm 6. Simple Calculator Algorithm

Algorithms 4. Odd or even Algorithm 5. Greatest among three numbers Algorithm 6. Simple Calculator Algorithm s 4. Odd or even Step 3 : If number divisible by 2 then Print "Number is Even" Step 3.1 : else Print "Number is Odd" Step 4 : Stop 5. Greatest among three numbers Step 2 : Read values of a, b and c Step

More information

Introduction to Computing Lecture 07: Repetition and Loop Statements (Part II)

Introduction to Computing Lecture 07: Repetition and Loop Statements (Part II) Introduction to Computing Lecture 07: Repetition and Loop Statements (Part II) Assist.Prof.Dr. Nükhet ÖZBEK Ege University Department of Electrical & Electronics Engineering nukhet.ozbek@ege.edu.tr Topics

More information

Question 2. [5 points] Given the following symbolic constant definition

Question 2. [5 points] Given the following symbolic constant definition CS 101, Spring 2012 Mar 20th Exam 2 Name: Question 1. [5 points] Determine which of the following function calls are valid for a function with the prototype: void drawrect(int width, int height); Assume

More information

Lab Session # 1 Introduction to C Language. ALQUDS University Department of Computer Engineering

Lab Session # 1 Introduction to C Language. ALQUDS University Department of Computer Engineering 2013/2014 Programming Fundamentals for Engineers Lab Lab Session # 1 Introduction to C Language ALQUDS University Department of Computer Engineering Objective: Our objective for today s lab session is

More information

Basic and Intermediate Math Vocabulary Spring 2017 Semester

Basic and Intermediate Math Vocabulary Spring 2017 Semester Digit A symbol for a number (1-9) Whole Number A number without fractions or decimals. Place Value The value of a digit that depends on the position in the number. Even number A natural number that is

More information

Government Polytechnic Muzaffarpur.

Government Polytechnic Muzaffarpur. Government Polytechnic Muzaffarpur. Name of the Lab: COMPUTER PROGRAMMING LAB (MECH. ENGG. GROUP) Subject Code: 1625408 Experiment: 1 Aim: Programming exercise on executing a C program. If you are looking

More information

ITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University

ITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University ITC213: STRUCTURED PROGRAMMING Bhaskar Shrestha National College of Computer Studies Tribhuvan University Lecture 08: Control Statements Readings: Chapter 6 Control Statements and Their Types A control

More information

Answer for I/O Operation Exercise:

Answer for I/O Operation Exercise: Answer for I/O Operation Exercise: 1) Write a program to input the rainfall of three consecutive days in CMS and find its average. float a,b,c,avg; printf("enter the rainfalls of three days in Cms:");

More information

2008/11/05: Lecture 15 CMSC 104, Section 0101 John Y. Park

2008/11/05: Lecture 15 CMSC 104, Section 0101 John Y. Park 2008/11/05: Lecture 15 CMSC 104, Section 0101 John Y. Park 1 Topics Review 0f C program Functions - Overview Using Predefined Functions Programmer-Defined Functions Using Input Parameters Function Header

More information

LAB 6 FUNCTIONS I School of Computer and Communication Engineering

LAB 6 FUNCTIONS I School of Computer and Communication Engineering LAB 6 FUNCTIONS I School of Computer and Communication Engineering 1 Universiti Malaysia Perlis 1. OBJECTIVES: 1.1 To apply functions as building blocks of programs. 1.2 To write C programs using functions.

More information

Unit 1: Algorithmic problem solving 1

Unit 1: Algorithmic problem solving 1 GE8151 PROBLEM SOLVING AND PYTHON PROGRAMMING UNIT I ALGORITHMIC PROBLEM SOLVING Algorithms, building blocks of algorithms (statements, state, control flow, functions), notation (pseudo code, flow chart,

More information

CHRIST THE KING BOYS MATRIC HR. SEC. SCHOOL, KUMBAKONAM CHAPTER 9 C++

CHRIST THE KING BOYS MATRIC HR. SEC. SCHOOL, KUMBAKONAM CHAPTER 9 C++ CHAPTER 9 C++ 1. WRITE ABOUT THE BINARY OPERATORS USED IN C++? ARITHMETIC OPERATORS: Arithmetic operators perform simple arithmetic operations like addition, subtraction, multiplication, division etc.,

More information

Solve 3-D problems using Pythagoras theorem and trigonometric ratios (A*) Solve more complex 2-D problems using Pythagoras theorem & trigonometry (A)

Solve 3-D problems using Pythagoras theorem and trigonometric ratios (A*) Solve more complex 2-D problems using Pythagoras theorem & trigonometry (A) Moving from A to A* Solve 3-D problems using Pythagoras theorem and trigonometric ratios (A*) A* Use the sine & cosine rules to solve more complex problems involving non right-angled triangles (A*) Find

More information

Mensuration: Basic Concepts and Important Formulas

Mensuration: Basic Concepts and Important Formulas Equilateral Triangle: All the three sides are equal and each angle is equal to. Height (Altitude) = 3(side) Isosceles Triangle: Two sides and two angles are equal and altitude drawn on nonequal side bisects

More information

Pages do a,c,e only (for questions that have parts)

Pages do a,c,e only (for questions that have parts) use their knowledge of rectangles, parallelograms and triangles to deduce formulae for the area of a parallelogram, and a triangle, from the formula for the area of a rectangle solve problems involving

More information

Key Vocabulary Index. Key Vocabulary Index

Key Vocabulary Index. Key Vocabulary Index Key Vocabulary Index Mathematical terms are best understood when you see them used and defined in context. This index lists where you will find key vocabulary. A full glossary is available in your Record

More information

Chapters 1.18 and 2.18 Areas, Perimeters and Volumes

Chapters 1.18 and 2.18 Areas, Perimeters and Volumes Chapters 1.18 and.18 Areas, Perimeters and Volumes In this chapter, we will learn about: From Text Book 1: 1. Perimeter of a flat shape: 1.A Perimeter of a square 1.B Perimeter of a rectangle 1.C Perimeter

More information

Course Outline. Introduction to java

Course Outline. Introduction to java Course Outline 1. Introduction to OO programming 2. Language Basics Syntax and Semantics 3. Algorithms, stepwise refinements. 4. Quiz/Assignment ( 5. Repetitions (for loops) 6. Writing simple classes 7.

More information

Scott Foresman Investigations in Number, Data, and Space Content Scope & Sequence Correlated to Academic Language Notebooks The Language of Math

Scott Foresman Investigations in Number, Data, and Space Content Scope & Sequence Correlated to Academic Language Notebooks The Language of Math Scott Foresman Investigations in Number, Data, and Space Content Scope & Sequence Correlated to Academic Language Notebooks The Language of Math Grade 5 Content Scope & Sequence Unit 1: Number Puzzles

More information

Arithmetic Expressions Lesson #1 Outline

Arithmetic Expressions Lesson #1 Outline Outline 1. Outline 2. A Less Simple C Program #1 3. A Less Simple C Program #2 4. A Less Simple C Program #3 5. A Less Simple C Program #4 6. A Less Simple C Program: Compile & Run 7. Flowchart for my_add.c

More information

LOOPS. 1- Write a program that prompts user to enter an integer N and determines and prints the sum of cubes from 5 to N (i.e. sum of 5 3 to N 3 ).

LOOPS. 1- Write a program that prompts user to enter an integer N and determines and prints the sum of cubes from 5 to N (i.e. sum of 5 3 to N 3 ). LOOPS 1- Write a program that prompts user to enter an integer N and determines and prints the sum of cubes from 5 to N (i.e. sum of 5 3 to N 3 ). 2-Give the result of the following program: #include

More information

PESIT Bangalore South Campus Hosur Road (1km before Electronic City), Bengaluru Department of Basic Science and Humanities

PESIT Bangalore South Campus Hosur Road (1km before Electronic City), Bengaluru Department of Basic Science and Humanities SOLUTION OF CONTINUOUS INTERNAL EVALUATION TEST -1 Date : 27-02 2018 Marks:60 Subject & Code : Programming in C and Data Structures- 17PCD23 Name of faculty : Dr. J Surya Prasad/Mr. Naushad Basha Saudagar

More information

Grade 7 Mensuration - Perimeter, Area, Volume

Grade 7 Mensuration - Perimeter, Area, Volume ID : ae-7-mensuration-perimeter-area-volume [1] Grade 7 Mensuration - Perimeter, Area, Volume For more such worksheets visit www.edugain.com Answer the questions (1) A teacher gave a rectangular colouring

More information

MA 511: Computer Programming Lecture 2: Partha Sarathi Mandal

MA 511: Computer Programming Lecture 2: Partha Sarathi Mandal MA 511: Computer Programming Lecture 2: http://www.iitg.ernet.in/psm/indexing_ma511/y10/index.html Partha Sarathi Mandal psm@iitg.ernet.ac.in Dept. of Mathematics, IIT Guwahati Semester 1, 2010-11 Largest

More information

LAB 6: While and do-while Loops

LAB 6: While and do-while Loops Name: Joe Bloggs LAB 6: While and do-while Loops Exercises 1 while loop /* Program name: lab6ex1.c * Purpose : This program demonstrates use of while loop int num = 0; while( num!= -1 ) printf("please

More information

Perimeter, Area, Surface Area, & Volume

Perimeter, Area, Surface Area, & Volume Additional Options: Hide Multiple Choice Answers (Written Response) Open in Microsoft Word (add page breaks and/or edit questions) Generation Date: 11/25/2009 Generated By: Margaret Buell Copyright 2009

More information

LAB 6 FUNCTION PART 1 School of Computer and Communication Engineering Universiti Malaysia Perlis

LAB 6 FUNCTION PART 1 School of Computer and Communication Engineering Universiti Malaysia Perlis Laboratory Module [Updated October 2017] LAB 6 FUNCTION PART 1 School of Computer and Communication Engineering Universiti Malaysia Perlis 1 OBJECTIVES 1. To differentiate between predefined function and

More information

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Basic Science and Humanities

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Basic Science and Humanities PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Basic Science and Humanities Continuous Internal Evaluation Test 2 Date: 0-10- 2017 Marks: 0 Subject &

More information

Chapter 3 Problem Solving and the Computer

Chapter 3 Problem Solving and the Computer Chapter 3 Problem Solving and the Computer An algorithm is a step-by-step operations that the CPU must execute in order to solve a problem, or to perform that task. A program is the specification of an

More information

1. The keyword main in C language is used for

1. The keyword main in C language is used for 1. The keyword main in C language is used for a. an user defined function *b. the first function to be executed in the program c. an user defined variable 2. The role of a C compiler is to translate a.

More information

Lecture 16. Daily Puzzle. Functions II they re back and they re not happy. If it is raining at midnight - will we have sunny weather in 72 hours?

Lecture 16. Daily Puzzle. Functions II they re back and they re not happy. If it is raining at midnight - will we have sunny weather in 72 hours? Lecture 16 Functions II they re back and they re not happy Daily Puzzle If it is raining at midnight - will we have sunny weather in 72 hours? function prototypes For the sake of logical clarity, the main()

More information

These are reserved words of the C language. For example int, float, if, else, for, while etc.

These are reserved words of the C language. For example int, float, if, else, for, while etc. Tokens in C Keywords These are reserved words of the C language. For example int, float, if, else, for, while etc. Identifiers An Identifier is a sequence of letters and digits, but must start with a letter.

More information

Scheme G. Sample Test Paper-I. Course Name : Computer Engineering Group Course Code : CO/CD/CM/CW/IF Semester : Second Subject Tile : Programming in C

Scheme G. Sample Test Paper-I. Course Name : Computer Engineering Group Course Code : CO/CD/CM/CW/IF Semester : Second Subject Tile : Programming in C Sample Test Paper-I Marks : 25 Time:1 Hrs. Q1. Attempt any THREE 09 Marks a) State four relational operators with meaning. b) State the use of break statement. c) What is constant? Give any two examples.

More information

Engineering 12 - Spring, 1998

Engineering 12 - Spring, 1998 Engineering 12 - Spring, 1998 1. (15 points) Rewrite the following program so that it uses a while loop in place of the for loop. (Note that a part of the new program is already shown at the bottom of

More information

Chapter 2. Introduction to C language. Together Towards A Green Environment

Chapter 2. Introduction to C language. Together Towards A Green Environment Chapter 2 Introduction to C language Aim Aim of this chapter is to provide the fundamentals for basic program construction using C. Objectives To understand the basic information such as keywords, character

More information

Variables in C. CMSC 104, Spring 2014 Christopher S. Marron. (thanks to John Park for slides) Tuesday, February 18, 14

Variables in C. CMSC 104, Spring 2014 Christopher S. Marron. (thanks to John Park for slides) Tuesday, February 18, 14 Variables in C CMSC 104, Spring 2014 Christopher S. Marron (thanks to John Park for slides) 1 Variables in C Topics Naming Variables Declaring Variables Using Variables The Assignment Statement 2 What

More information

Fundamentals of Programming & Procedural Programming

Fundamentals of Programming & Procedural Programming Universität Duisburg-Essen PRACTICAL TRAINING TO THE LECTURE Fundamentals of Programming & Procedural Programming Session Eight: Math Functions, Linked Lists, and Binary Trees Name: First Name: Tutor:

More information

Mr. Whelan Name: Block:

Mr. Whelan Name: Block: Mr. Whelan Name: Block: Geometry/Trig Unit 10 Area and Volume of Solids Notes Packet Day 1 Notes - Prisms Rectangular Prism: How do we find Total Area? Example 1 6cm Find the area of each face: Front:

More information

Name: Target 12.2: Find and apply surface of Spheres and Composites 12.2a: Surface Area of Spheres 12.2b: Surface Area of Composites Solids

Name: Target 12.2: Find and apply surface of Spheres and Composites 12.2a: Surface Area of Spheres 12.2b: Surface Area of Composites Solids Unit 12: Surface Area and Volume of Solids Target 12.0: Euler s Formula and Introduction to Solids Target 12.1: Find and apply surface area of solids 12.1a: Surface Area of Prisms and Cylinders 12.1b:

More information

Module-2: Branching and Looping

Module-2: Branching and Looping Module-2: Branching and Looping Branching Statements: In sequential control, all the statements are executed in the order in which they are written sequentially in a program from top to bottom. However,

More information

Preview from Notesale.co.uk Page 4 of 63

Preview from Notesale.co.uk Page 4 of 63 1. Write a program to compute area of a circle after reading input from user. #include #include int float area, radius, pi=3.141; printf("enter the radius of circle \t"); scanf("%f",

More information

C/Java Syntax. January 13, Slides by Mark Hancock (adapted from notes by Craig Schock)

C/Java Syntax. January 13, Slides by Mark Hancock (adapted from notes by Craig Schock) C/Java Syntax 1 Lecture 02 Summary Keywords Variable Declarations Data Types Operators Statements if, switch, while, do-while, for Functions 2 By the end of this lecture, you will be able to identify the

More information

C/Java Syntax. Lecture 02 Summary. Keywords Variable Declarations Data Types Operators Statements. Functions. if, switch, while, do-while, for

C/Java Syntax. Lecture 02 Summary. Keywords Variable Declarations Data Types Operators Statements. Functions. if, switch, while, do-while, for C/Java Syntax 1 Lecture 02 Summary Keywords Variable Declarations Data Types Operators Statements if, switch, while, do-while, for Functions 2 1 By the end of this lecture, you will be able to identify

More information

/* Area and circumference of a circle */ /*celsius to fahrenheit*/

/* Area and circumference of a circle */ /*celsius to fahrenheit*/ /* Area and circumference of a circle */ #include #include #define pi 3.14 int radius; float area, circum; printf("\nenter radius of the circle : "); scanf("%d",&radius); area = pi

More information

Volume of Cylinders. Volume of Cones. Example Find the volume of the cylinder. Round to the nearest tenth.

Volume of Cylinders. Volume of Cones. Example Find the volume of the cylinder. Round to the nearest tenth. Volume of Cylinders As with prisms, the area of the base of a cylinder tells the number of cubic units in one layer. The height tells how many layers there are in the cylinder. The volume V of a cylinder

More information

2. Numbers In, Numbers Out

2. Numbers In, Numbers Out COMP1917: Computing 1 2. Numbers In, Numbers Out Reading: Moffat, Chapter 2. COMP1917 15s2 2. Numbers In, Numbers Out 1 The Art of Programming Think about the problem Write down a proposed solution Break

More information

1.4 Perimeter, Area and Surface Area of Similar Figures

1.4 Perimeter, Area and Surface Area of Similar Figures Foundations of Math Section.4 Perimeter, rea and Surface rea of Similar Figures 35.4 Perimeter, rea and Surface rea of Similar Figures The squares shown below are similar. The corresponding sides are in

More information

S8.6 Volume. Section 1. Surface area of cuboids: Q1. Work out the surface area of each cuboid shown below:

S8.6 Volume. Section 1. Surface area of cuboids: Q1. Work out the surface area of each cuboid shown below: Things to Learn (Key words, Notation & Formulae) Complete from your notes Radius- Diameter- Surface Area- Volume- Capacity- Prism- Cross-section- Surface area of a prism- Surface area of a cylinder- Volume

More information

Geometry - Additional Questions: Sheet 1

Geometry - Additional Questions: Sheet 1 Geometry - Additional Questions: Sheet 1 Parallel Lines Eercises (G3E) e g f h L1 L1 L2 1.) How many angles do you need to know in order to replace the letters in the diagram to the left? b c a d L2 2.)

More information

Syntax of for loop is as follows: for (inite; terme; updatee) { block of statements executed if terme is true;

Syntax of for loop is as follows: for (inite; terme; updatee) { block of statements executed if terme is true; Birla Institute of Technology & Science, Pilani Computer Programming (CSF111) Lab-5 ---------------------------------------------------------------------------------------------------------------------------------------------

More information

***************OUTPUT*************************** Enter the two number The addition of two number is =100

***************OUTPUT*************************** Enter the two number The addition of two number is =100 /* 1. Program to calculate the addition of two number using function */ int n1,n2,result; printf(" Enter the two number \n"); scanf("%d%d",&n1,&n2); result=addnum(n1,n2); printf(" The addition of two number

More information

Single Dimension Arrays

Single Dimension Arrays ARRAYS Single Dimension Arrays Array Notion of an array Homogeneous collection of variables of same type. Group of consecutive memory locations. Linear and indexed data structure. To refer to an element,

More information

Assignment: 1. (Unit-1 Flowchart and Algorithm)

Assignment: 1. (Unit-1 Flowchart and Algorithm) Assignment: 1 (Unit-1 Flowchart and Algorithm) 1. Explain: Flowchart with its symbols. 2. Explain: Types of flowchart with example. 3. Explain: Algorithm with example. 4. Draw a flowchart to find the area

More information

Guide for The C Programming Language Chapter 1. Q1. Explain the structure of a C program Answer: Structure of the C program is shown below:

Guide for The C Programming Language Chapter 1. Q1. Explain the structure of a C program Answer: Structure of the C program is shown below: Q1. Explain the structure of a C program Structure of the C program is shown below: Preprocessor Directives Global Declarations Int main (void) Local Declarations Statements Other functions as required

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) MODEL ANSWER

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) MODEL ANSWER Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model answer and the answer written by candidate

More information

Branching is deciding what actions to take and Looping is deciding how many times to take a certain action.

Branching is deciding what actions to take and Looping is deciding how many times to take a certain action. 3.0 Control Statements in C Statements The statements of a C program control the flow of program execution. A statement is a command given to the computer that instructs the computer to take a specific

More information

Babaria Institute of Technology Computer Science and Engineering Department Practical List of Object Oriented Programming with C

Babaria Institute of Technology Computer Science and Engineering Department Practical List of Object Oriented Programming with C Practical -1 Babaria Institute of Technology LEARN CONCEPTS OF OOP 1. Explain Object Oriented Paradigm with figure. 2. Explain basic Concepts of OOP with example a. Class b. Object c. Data Encapsulation

More information

Essar Placement Paper

Essar Placement Paper Essar Placement Paper Question 1 The fourth proportional to 5, 8, 15 is: A. 18 B. 24 C. 19 D. 20 Let the fourth proportional to 5, 8, 15 be x. Then, 5 : 8 : 15 : x 5x = (8 x 15) x=(8*15)/5=24 Question

More information

Connecticut Alternate Assessment: Individual Student Report Performance Literals Mathematics

Connecticut Alternate Assessment: Individual Student Report Performance Literals Mathematics Connecticut Alternate Assessment: Individual Student Report Performance Literals Mathematics Published November 9, 2016 Copyright 2016 by the Connecticut State Board of Education in the name of the Secretary

More information

CSE101-Lec#18. Multidimensional Arrays Application of arrays. Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU. LPU CSE101 C Programming

CSE101-Lec#18. Multidimensional Arrays Application of arrays. Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU. LPU CSE101 C Programming CSE101-Lec#18 Multidimensional Arrays Application of arrays Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU Outline Defining and processing 1D array 2D array Applications of arrays 1-D array A

More information

Formatted Output / User IO

Formatted Output / User IO / User IO 1 / 22 / User IO COMP SCI / SFWR ENG 2S03 Natalie Perna Dylan Aspden Department of Computing and Software McMaster University Week 4: Sept 29 - Oct 3 Natalie Perna, Dylan Aspden / User IO 1 /

More information

UIC. C Programming Primer. Bharathidasan University

UIC. C Programming Primer. Bharathidasan University C Programming Primer UIC C Programming Primer Bharathidasan University Contents Getting Started 02 Basic Concepts. 02 Variables, Data types and Constants...03 Control Statements and Loops 05 Expressions

More information

Aptitude Volume and Surface Area. Theory

Aptitude Volume and Surface Area. Theory Aptitude Volume and Surface Area Theory Volume Volume is the amount of space inside a three-dimensional (length, width and height.) object, or its capacity. measured in cubic units. Surfce Area Total area

More information

Projects / Graded Assignments

Projects / Graded Assignments Unit 3. s Unit 3. s Unit 3. s 1 Decimals Put students in groups. Each group will create 5 different decimals compare these numbers and arrange them in ascending and descending order. 2 Decimals Answer

More information

Math 366 Chapter 13 Review Problems

Math 366 Chapter 13 Review Problems 1. Complete the following. Math 366 Chapter 13 Review Problems a. 45 ft = yd e. 7 km = m b. 947 yd = mi f. 173 cm = m c. 0.25 mi = ft g. 67 cm = mm d. 289 in. = yd h. 132 m = km 2. Given three segments

More information

Year 9 Key Performance Indicators Maths (Number)

Year 9 Key Performance Indicators Maths (Number) Key Performance Indicators Maths (Number) M9.1 N1: I can apply the four operations to negative numbers. Raise negative numbers to a power Add and subtract negative numbers and know when the answer should

More information

C Exercises. Ben Vandiver February 28, 2003

C Exercises. Ben Vandiver February 28, 2003 C Exercises Ben Vandiver February 28, 2003 1 General Information These exercises are intended for you to practice on. Since they won t be graded, they are to help you practice the types of things you will

More information

Laboratory 2: Programming Basics and Variables. Lecture notes: 1. A quick review of hello_comment.c 2. Some useful information

Laboratory 2: Programming Basics and Variables. Lecture notes: 1. A quick review of hello_comment.c 2. Some useful information Laboratory 2: Programming Basics and Variables Lecture notes: 1. A quick review of hello_comment.c 2. Some useful information 3. Comment: a. name your program with extension.c b. use o option to specify

More information

16.216: ECE Application Programming Fall 2011

16.216: ECE Application Programming Fall 2011 16.216: ECE Application Programming Fall 2011 Exam 2 Solution 1. (24 points, 6 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by circling

More information

Subject: PIC Chapter 2.

Subject: PIC Chapter 2. 02 Decision making 2.1 Decision making and branching if statement (if, if-, -if ladder, nested if-) Switch case statement, break statement. (14M) 2.2 Decision making and looping while, do, do-while statements

More information

Computer System and programming in C

Computer System and programming in C 1 Basic Data Types Integral Types Integers are stored in various sizes. They can be signed or unsigned. Example Suppose an integer is represented by a byte (8 bits). Leftmost bit is sign bit. If the sign

More information

WARM UP LESSONS BARE BASICS

WARM UP LESSONS BARE BASICS WARM UP LESSONS BARE BASICS CONTENTS Common primitive data types for variables... 2 About standard input / output... 2 More on standard output in C standard... 3 Practice Exercise... 6 About Math Expressions

More information

CSE 115 Programming Language I Final Examination Fall 2015

CSE 115 Programming Language I Final Examination Fall 2015 CSE 115 Programming Language I Final Examination Fall 2015 Total Marks 75. Time 90 minutes Instructions You have to answer three out of five questions from Section 1. Section 2 is a mandatory section.

More information

Integer Representation. Variables. Real Representation. Integer Overflow/Underflow

Integer Representation. Variables. Real Representation. Integer Overflow/Underflow Variables Integer Representation Variables are used to store a value. The value a variable holds may change over its lifetime. At any point in time a variable stores one value (except quantum computers!)

More information

Programming Language A

Programming Language A Programming Language A Takako Nemoto (JAIST) 22 October Takako Nemoto (JAIST) 22 October 1 / 28 From Homework 2 Homework 2 1 Write a program calculate something with at least two integer-valued inputs,

More information

The figures below are all prisms. The bases of these prisms are shaded, and the height (altitude) of each prism marked by a dashed line:

The figures below are all prisms. The bases of these prisms are shaded, and the height (altitude) of each prism marked by a dashed line: Prisms Most of the solids you ll see on the Math IIC test are prisms or variations on prisms. A prism is defined as a geometric solid with two congruent bases that lie in parallel planes. You can create

More information

Introduction to Java Applications

Introduction to Java Applications 2 Introduction to Java Applications OBJECTIVES In this chapter you will learn: To write simple Java applications. To use input and output statements. Java s primitive types. Basic memory concepts. To use

More information

Math-2 Lesson 6-3: Area of: Triangles, rectangles, circles and Surface Area of Pyramids

Math-2 Lesson 6-3: Area of: Triangles, rectangles, circles and Surface Area of Pyramids Math- Lesson 6-3: rea of: Triangles, rectangles, circles and Surface rea of Pyramids SM: Lesson 6-3 (rea) For the following geometric shapes, how would you answer the question; how big is it? Describe

More information

Lecture 02 Summary. C/Java Syntax 1/14/2009. Keywords Variable Declarations Data Types Operators Statements. Functions

Lecture 02 Summary. C/Java Syntax 1/14/2009. Keywords Variable Declarations Data Types Operators Statements. Functions Lecture 02 Summary C/Java Syntax Keywords Variable Declarations Data Types Operators Statements if, switch, while, do-while, for Functions 1 2 By the end of this lecture, you will be able to identify the

More information

Structured programming

Structured programming Exercises 4 Version 1.0, 10 October, 2016 Table of Contents 1. Flow control statements if-else............................................. 1 1.1. From lectures...........................................................

More information

ME 172. C Programming Language Sessional Lecture 8

ME 172. C Programming Language Sessional Lecture 8 ME 172 C Programming Language Sessional Lecture 8 Functions Functions are passages of code that have been given a name. C functions can be classified into two categories Library functions User-defined

More information

York Public Schools Subject Area: Mathematics Course: 6 th Grade Math NUMBER OF DAYS TAUGHT DATE

York Public Schools Subject Area: Mathematics Course: 6 th Grade Math NUMBER OF DAYS TAUGHT DATE 6.1.1.d 6.EE.A.1 Represent large numbers using exponential notation (i.e.. 10x10x10x10x10) (Review PV chart first) Write evaluate numerical expressions involving whole number exponents 5 days August, Lesson

More information

Chapter 1: Symmetry and Surface Area

Chapter 1: Symmetry and Surface Area Chapter 1: Symmetry and Surface Area Name: Section 1.1: Line Symmetry Line of symmetry(or reflection): divides a shape or design into two parts. Can be found using: A mirra Folding Counting on a grid Section

More information

Programming Language A

Programming Language A Programming Language A Takako Nemoto (JAIST) 12 November Takako Nemoto (JAIST) 12 November 1 / 25 From Quiz 5 // A program to print the double of the input. int no printf("input an integer: "); scanf("%d",

More information

Use a calculator and c = 2 π r to calculate the circumference of a circle with a radius of 1.0.

Use a calculator and c = 2 π r to calculate the circumference of a circle with a radius of 1.0. Floating Point Math Submitted by Andy Lindsay on Thu, 03/21/2013-16:37 original source: http://learn.parallax.com/propeller-c-start-simple/floating-point-math Lesson edited to work with Dev-C++ IDE by

More information