Exercise 1 #include int main() { printf(“Hello C Programming!\n”); return 0; } 1.Run your Visual Studio 2008 or 2013. 2.Create a new “project” and add.

Slides:



Advertisements
Similar presentations
Variables in C Amir Haider Lecturer.
Advertisements

What is shape function ? shape function is a function that will give the displacements inside an element if its displacement at all the node locations.
Making Choices in C if/else statement logical operators break and continue statements switch statement the conditional operator.
We Have Learned main() { … } Variable –Definition –Calculation –Display We can do some real programming! –Think about your solution design –Express design.
L2:CSC © Dr. Basheer M. Nasef Lecture #2 By Dr. Basheer M. Nasef.
CS1010 Programming Methodology
CS1010 Programming Methodology
TDBA66, VT-03 Lecture - Ch. 21 A complete C-program Display Fig. 2.1 and comment on different things such as Preprocessor directives Header files Identifiers.
An intro to programming concepts with Scratch Session 2 of 10 sessions I/O, variables, simple computing.
Lecture 8. Review (Methods of Math class) int abs( int num ) double sqrt( double num ) double pow( double num, double power ) Method parametersData type.
Chapter 1 Pseudocode & Flowcharts
Python. What is Python? A programming language we can use to communicate with the computer and solve problems We give the computer instructions that it.
Software Engineering 1 (Chap. 1) Object-Centered Design.
Computer Programming Lab(4).
Computer Programming Lab(5).
Rewrite Formulas and Equations
LAB 2 : PROBLEM SOLVING TECHNIQUES, ALGORITHM: PSEUDO CODE AND FLOWCHART LAB INTRODUCTION Prepared by: Cik Noor Syazana bt Arshad.
CPS 2231 Computer Organization and Programming Instructor: Tian (Tina) Tian.
Microsoft® Small Basic
Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved. 1 Chapter 2 Elementary Programming.
Chapter 3 COMPLETING THE BASICS Programming Fundamentals with C++1.
Goals of Course Introduction to the programming language C Learn how to program Learn ‘good’ programming practices.
Chapter 3 Processing and Interactive Input. 2 Assignment  The general syntax for an assignment statement is variable = operand; The operand to the right.
E0001 Computers in Engineering Procedures: subprograms and functions.
Chapter 10 Test Formula Review.  Find the circumference of a circle with a diameter of 10. Identify the formula needed for the following questions.
The circumference of the circle is 50  feet. The area of the shaded region = ________ example 1 :
More While Loop Examples CS303E: Elements of Computers and Programming.
How to start Visual Studio 2008 or 2010 (command-line program)
Perimeter = 2*(length+width)
C++ Programming: Basic Elements of C++.
Nested LOOPS.
C Programming Lecture 5 : Basic standard I/O Lecture notes : courtesy of Ohio Supercomputing Center, science and technolgy support.
Previously Repetition Structures While, Do-While, For.
C OMPUTER P ROGRAMMING 1 Assignment. A SSIGNMENT We have used gets to input a value into variable The second way to give a variable a value is known as.
1 Original Source : and Problem and Problem Solving.ppt.
Basics of Most C++ Programs // Programmer: Clayton Price date: 9/4/ // File: fahr2celc.cpp 03. // Purpose:
Perimeter and Area January 24, Perimeter Example 1Find the Perimeter a. a square with a side length of 10 inches10 in. P = 4sPerimeter formula =
Additional Pair Programming Exercises 1. Problem 1 For a wheel of radius r feet, how many revolutions are required for that wheel to travel 1 mile? What.
INPUT & VARIABLES.
© T Madas. Find the mean percentage mark of 37%, 42%, 68%, 55% and 39%. Find of Find 7% of 675. Find the area of a triangle with base of 1.25.
E-1 University of Washington Computer Programming I Lecture 5: Input and Output (I/O) © 2000 UW CSE.
Programming Fundamentals with C++1 Chapter 3 COMPLETING THE BASICS.
Data Types and Conversions, Input from the Keyboard CS303E: Elements of Computers and Programming.
Operating System Discussion Section. The Basics of C Reference: Lecture note 2 and 3 notes.html.
Data Types and Conversions, Input from the Keyboard If you can't write it down in English, you can't code it. -- Peter Halpern If you lie to the computer,
Lecture 5: Expressions and Interactivity Professor: Dr. Miguel Alonso Jr. Fall 2008 CGS2423/COP1220.
1 CS 1430: Programming in C++. 2 Input: Input ends with -1 Sentinel-Controlled Loop Input: Input begins with.
1 Project 2: Using Variables and Expressions. 222 Project 2 Overview For this project you will work with three programs Circle Paint Ideal_Weight What.
Computer Programming for Engineers
Think First, Code Second Understand the problem Work out step by step procedure for solving the problem (algorithm) top down design and stepwise refinement.
Homework 1 (due:April 8th) Deadline : April 8th 11:59pm Where to submit? eClass “ 과제방 ” ( How to submit? Create a folder. The name.
Variables in C Topics  Naming Variables  Declaring Variables  Using Variables  The Assignment Statement Reading  Sections
Variables in C Topics  Naming Variables  Declaring Variables  Using Variables  The Assignment Statement Reading  Sections
CMSC 104, Version 8/061L09VariablesInC.ppt Variables in C Topics Naming Variables Declaring Variables Using Variables The Assignment Statement Reading.
1 1 Chapter 2 Elementary Programming. 2 2 Motivations In the preceding chapter, you learned how to create, compile, and run a Java program. Starting from.
1 Advanced Programming Windows Applications. Create a new Project Select a C# Windows Application.
Perimeter, Circumference and Area. Perimeter and Circumference Perimeter : The distance around a geometric figure. Circumference: The distance around.
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
Slide 1 Copyright © 2015, 2011, 2008 Pearson Education, Inc. Perimeter Section9.2.
NOTE: C programs consist of functions one of which must be main. C programs consist of functions one of which must be main. Every C program begins executing.
1 Lecture Three I/O Formatting and Arithmetic Dr. Sherif Mohamed Tawfik.
Problem Solving and Program Design in C Chap. 5 Repetition and Loop Statement Chow-Sing Lin.
G-11 (1-5) Using formulas in Geometry I can use formulas to compute perimeter and area of triangles, squares, rectangles, and circles.
Data Types and Conversions, Input from the Keyboard
Chapter 2 Assignment and Interactive Input
Input/Output Input/Output operations are performed using input/output functions Common input/output functions are provided as part of C’s standard input/output.
INPUT & OUTPUT scanf & printf.
Introduction to C Programming
Variables in C Topics Naming Variables Declaring Variables
The while Looping Structure
Presentation transcript:

Exercise 1 #include int main() { printf(“Hello C Programming!\n”); return 0; } 1.Run your Visual Studio 2008 or Create a new “project” and add a new C file to the project. 3.Write following simple C code 4.Build 5.Execute

1(a). Write a program that will obtain the length and width of a rectangle from the user and compute its area and perimeter. (Use float type for all variables.) Output Example : (  keyboard user input) ,

1(b). Write a program that reads in the radius(반지름) of a circle and prints the circle’s diameter(지름), circumference(둘레), and area(면적). Use the constant value for PI. #include int main() { float radius, diameter, circumference, area; // put your code here // use scanf to get the value of radius // use printf to display the result of calculation. } Output Example : Get radius? 3.5 (  keyboard user input) diameter = , circumference = , area =

2. Write a program to convert a temperature in degrees Fahrenheit to degrees Celsius. Celsius = 5.0 / 9.0 * (fahrenheit – 32) Input and Output Example : (  keyboard user input)

3. Write a program that predicts the score needed on a final exam to achieve a desired grade in a course. The program should interact with the user as follows: Input and Output Example : Enter desired grade> B Enter minimum average required> 79.5 Enter current average in course> 74.6 Enter how much the final counts as a percentage of the course grade> 25 You need a score of on the final to get a B.

4. Write a program that converts meter-type height into [feet(integer),inch(float)]-type height. Your program should get one float typed height value as a keyboard input and prints integer typed feet value and the rest of the height is represented as inch type. (1m=3.2808ft=39.37inch) (input and output format example) 1.80meter -> 5feet 10.9inch use automatic type conversion 1/2 = 0 (?), 3/2 = 1 (?) (ex) int a; float b; b = 3.6/2.0; a=b; printf(“a=%d, b=%f\n”,a,b);