Homework 2 (due:May 5th) Deadline : May 5th 11:59pm

Slides:



Advertisements
Similar presentations
C++ Basics March 10th. A C++ program //if necessary include headers //#include void main() { //variable declaration //read values input from user //computation.
Advertisements

Exercise 4 1. Write a program that simulates coin tossing. For each toss of the coin the program should print Heads or Tails. Let the program toss the.
1 Homework Reading –Tokheim, Section 5-10, 7-4 Machine Projects –Continue on MP4 Labs –Continue labs with your assigned section.
Software Development Method. Assignments Due – Homework 0, Warmup Reading – Chapter 2 –
1 10/9/06CS150 Introduction to Computer Science 1 for Loops.
Basic Input/Output and Variables Ethan Cerami New York
Programming is instructing a computer to perform a task for you with the help of a programming language.
Computer Architecture B-tree construction & Traversal YongSoo Bae Room 236, Engineering Building [Project 1]
BUILDING JAVA PROGRAMS CHAPTER 7 Arrays. Exam #2: Chapters 1-6 Thursday Dec. 4th.
How to start Visual Studio 2008 or 2010 (command-line program)
Structure of a C program Preprocessor directive (header file) Program statement } Preprocessor directive Global variable declaration Comments Local variable.
NA2204.1jcmt CSE 1320 Intermediate Programming C Program Basics Structure of a program and a function type name (parameters) { /* declarations */ statement;
National Tsing Hua University ® copyright OIA National Tsing Hua University HSA HW2.
Classes. Student class We are tasked with creating a class for objects that store data about students. We first want to consider what is needed for the.
Project 3: Ticket Printer
Homework #2: Functions and Arrays By J. H. Wang Mar. 24, 2014.
Exercise 3 Example> Write a C function that implements /* input : integer value n output : */ int f ( int n ) { int i, sum=0; for (i=1;i
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.
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.
1 Project 3 String Methods. Project 3: String Methods Write a program to do the following string manipulations: Prompt the user to enter a phrase and.
Homework 1 (due:April 10th) Deadline : April 10th 11:59pm Where to submit? eClass 과제방 ( How to submit? Create a folder. The name.
Homework 1 (due:April 8th) Deadline : April 8th 11:59pm Where to submit? eClass “ 과제방 ” ( How to submit? Create a folder. The name.
1 Project 4: Computing Distance. 222 Computing Distance Write a program to compute the distance between two points. Recall that the distance between the.
Homework 2 (due:April 17th) Deadline : April 17th 11:59pm Where to submit? eClass “ 과제방 ” ( How to submit? Create a folder. The.
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
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.
Homework 1 (due:April 13th) Deadline : April 13th 11:59pm Where to submit? eClass 과제방 ( How to submit? Create a folder. The name.
Exercise 2 : Using for loop Repetition (loop) (1)control variable initialization (2)Test Conditon (3)Modification of control variable value order : (1)
Homework 3 (due:May 27th) Deadline : May 27th 11:59pm
Formatted Input/Output
Data Types and Conversions, Input from the Keyboard
Chapter 2 - Introduction to C Programming
Standard Input - Output
Arrays Declarations CSCI N305
Introduction to C Language
Chapter 2 Overview of C.
ICS103 Programming in C Lecture 3: Introduction to C (2)
Variables, Expressions, and IO
Homework 3 (due:June 5th)
Chapter 2 - Introduction to C Programming
Formatted Input/Output
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.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
CS 1430: Programming in C++ Turn in your Quiz1-2 No time to cover HiC.
Chapter 2 - Introduction to C Programming
Chapter 2 - Introduction to C Programming
CSCE 206 Lab Structured Programming in C
Chapter 2 - Introduction to C Programming
Programming in JavaScript
Homework Reading Tokheim, Section 5-10, 7-4.
There are 10 types of people of people in this world…
Chapter 2 - Introduction to C Programming
Conversion Check your class notes and given examples at class.
Suppose I want to add all the even integers from 1 to 100 (inclusive)
Programming in JavaScript
How Computers Work Part 1 6 February 2008.
Programming in JavaScript
Programming in JavaScript
Introduction to C Programming
Homework 2 (due:May 15th) Deadline : May 15th 11:59pm
Homework 1 (due:April 17th)
Chapter 2 - Introduction to C Programming
Creating and Using Pointer Variables in C++ By: Ed Brunjes
Exercise 5 1. We learned bubble sort during class. This problem requires you to modify the code for bubble sorting method to implement the selection sorting.
National Chiao Tung University
CSCE 206 Lab Structured Programming in C
CSCE 206 Lab Structured Programming in C
Introduction to C Programming
Programming Arrays.
Homework 2 (due:May 13th) Deadline : May 11th 11:59pm
Presentation transcript:

Homework 2 (due:May 5th) Deadline : May 5th 11:59pm Where to submit? eClass 과제방 (http://eclass.cau.ac.kr) How to submit? Create a folder. The name of the folder should be “studentID#.hw2”. (ex) 20111499.hw2 We have three problems in hw2. Make three C source files. The name of the source files should be the format “studentID#.hw2.#.c” (ex) 20111499.hw2.1.c , 20111499.hw1.2.c , …, 20111499.hw1.4.c In each source file .c, your code must have comments that include your name and student_id# Put the source files into the folder we created. Compress the folder into a zip file. The name of the zip file should be “student#.hw2.zip”. (ex) 20111499.hw2.zip Upload the zip file into eClass website. If you don’t follow above instructions, you may get penalty in your score. You must do programming yourself.

Input example output example 1. Write a program that reads an integer N (0<=N<=1000000000) from keyboard and prints the sum of its digits as an output. #include <stdio.h> int main() { int N; // you may declare variables here scanf(“%d”,&N); // put your code here return 0; } Input example 427181392 output example 37  4+2+7+1+8+1+3+9+2

Input example output example  64+16+8+2+1 2.Input an integer B containing only 0 and 1 (i.e.,a binary integer) and print its decimal equivalent. Assume the total number of the binary digits is less than 10. #include <stdio.h> int main() { int B; // you may declare variables here scanf(“%d”,&B); // put your code here return 0; } Input example 01011011 output example 91  64+16+8+2+1

Input example  64+16+8+2+1 output example 3.Input a (decimal) integer value N and print its equivalent binary value containing 8 digits of only 0 and 1. Assume 0<=N<=255. #include <stdio.h> int main() { int N; // you may declare variables here scanf(“%d”,&N); // put your code here return 0; } Input example 91  64+16+8+2+1 output example 01011011

Input example output example 4. One interesting application of computers is histogram. Write a program that reads three numbers (each between 1 and 30). For each number read H, your program should print a line containing that number H and H adjacent asterisks. For example, if your program reads the number seven, it should print 7:*******. Be careful about the alignment. #include <stdio.h> int main() { int h1,h2,h3; // you may declare variables here scanf(“%d %d %d”,&h1,&h2,&h3); // put your code here return 0; } Input example 3 15 8 output example 3:*** 15:*************** 8:********