Programs Day 1 and 2. Write a Program to: 1: Read in two numbers and output the largest 2: Read in an exam mark and output the appropriate grade according.

Slides:



Advertisements
Similar presentations
Triangles TOPIC 9 LESSON 9-5.
Advertisements

Triangles. Equilateral triangle: A triangle with all three sides equal in measure. The slash marks indicate equal measure. Isosceles triangle: A triangle.
BBS514 Structured Programming (Yapısal Programlama)1 Selective Structures.
Unit 2 The if-else-if LECTURE – 14
Determining if a Triangle is Possible. How many different acute triangles can you draw? How many different right scalene triangles can you draw? Recall.
Tutorial #5 Summer while x = -2; while (x < 0) { printf("x is still negative :(\n"); x++; } printf("x is no longer negative.\n");
To remind us We finished the last day by introducing If statements Their structure was:::::::::
C programming an Introduction. Types There are only a few basic data types in C. char a character int an integer, in the range -32,767 to 32,767 long.
HOW MANY SIDES ARE THERE, AND WHAT IS THEIR ANGLE?
Classifying Triangles Students will classify triangles using the lengths of the sides and the angles. S. Calahan October 2010.
Classify Triangles Standard 4C.
EQUILATERAL & ISOSCELES Quiz tomorrow. CLASSIFY the triangle by ANGLES and SIDES Angles: acute, obtuse, right Sides:equilateral, isosceles, scalene 91.
Let’s revise some angles Angles What names of angles do you know? ACUTE RIGHT ANGLE OBTUSEREFLEX Less than 90 o Exactly 90 o Between 90 o and 180 o Between.
Introduction to Computing Lecture 05: Selection (continued) Introduction to Computing Lecture 05: Selection (continued) Assist.Prof.Dr. Nükhet ÖZBEK Ege.
Decision making statements. Decision making statements are used to skip or to execute a group of statements based on the result of some condition. The.
C Programming Lecture 7 : Control Structures. Control Structures Conditional statement : if, switch Determine a block of statements to execute depending.
Triangle A polygon with three sides and three angles. A triangle can be names by its’ side lengths and angles. – Side lengths: isosceles, equilateral,
Triangles and Lines – Introduction to Triangles
Classifying Triangles 9 th Grade Geometry Ms. Garner Click to Learn!
Program to calculate product of odd numbers b/w 1 and 15 #include main() { int prod = 1, x; for(x = 1; x
Classify triangles by sides No congruent sides Scalene triangle At least two sides congruent Isosceles triangle Three congruent sides Equilateral triangle.
TRIANGLES AND TYPES OF TRIANGLES. A triangle has three sides.
Types of Triangles. Equilateral Triangle All sides are the same length and all the angles are the same length.
Triangles 1st year P26 Chapter 4.
Types of Triangles. Angles The angles in a triangle add up to o + 60 o + 60 o =
Asstt. Prof Mandeep Kaur Computer Dept. TOPIC: Control Statements in C language.
Equilateral, Isosceles, Scalene, Right, Acute, Obtuse Types of Triangles.
Time for Triangles. What is a triangle? A triangle is a polygon. It has 3 sides and 3 angles. It can also be called a trigon.
Classifying Triangles. Two Ways to Classify Triangles  By Their Sides  By Their Angles.
Scalene triangle: A scalene triangle is a triangle that has no equal sides. The following is a scalene triangle.
Lesson 8.3 Concept: How to classify triangles by their sides and angles. An equilateral triangle has three sides of the same length. An isosceles triangle.
Learning Objective Identify triangles using their sides.
Triangles.
Classify the triangle by its angles and by its sides.
Triangles.
Classifying Triangles
Triangles.
TRIANGLE A B C.
MCC.4.G.1-2 All About Triangles.
5th Grade Academic Vocabulary Triangles
Triangles: Classifications, Angles and More
CLASSIFICATIONS, ANGLES AND MORE!!
Classifying Triangles
Lesson 5-3 Triangles Obj: I can find unknown angles and identify possible side lengths in triangles HWK: p all, all Vocab: 1) Triangle Sum.
Classifying Triangles
5th Grade Academic Vocabulary Triangles
Geometry.
Right Triangle Definition: A triangle with one 90 degree angle.
Lesson 3-2 Isosceles Triangles.
Triangles Grade 4.
Classifying Triangles

Objective - To classify triangles.
Lesson 5-3 Triangles Obj: The student will be able to find unknown angles and identify possible side lengths in triangles HWK: p all, all.
Triangles Guided Notes
Add up all the sides Perimeter of Area of a Rectangle: ANY polygon:
Lesson 5-3 Triangles Obj: I can find unknown angles and identify possible side lengths in triangles HWK: p all, all Vocab: 1) Triangle Sum.
Identify type of triangle
Types of Triangles Thursday, 11 April 2019.
Types of Triangles Thursday, 11 April 2019.
Triangles.
Front of Flipbook Right Triangles Acute Triangles Obtuse Triangles
Intro to Triangles.
Classifying Triangles
Classifying Triangles
4-1 Classifying Triangles
CSCE 206 Lab Structured Programming in C
Made by Ms. Shobhana Sharma By KV INS HAMLA
Area and Perimeter Triangles.
Presentation transcript:

Programs Day 1 and 2

Write a Program to: 1: Read in two numbers and output the largest 2: Read in an exam mark and output the appropriate grade according to the following scheme. 85 and over - A 70 to 84 - B C D E otherwise 3: Write a program which reads in the three sides of a triangle and detemines whether it is Equilateral, Isoceles or Scalene

Larger of Two Numbers #Include main() { int a,b; printf(“enter first number \n”); scanf(“%d”,&a); printf(“enter second number \n”); scanf(“%d”,&b ); If (a > b ) printf(“%d is greater than %d ”,a,b); Else printf(“%d is greater than %d ”,b,a); }

Output the Grade #Include main() { int grade; printf(“Enter Exam Mark \n”); scanf(“%d”,&grade); if(grade >= 85) printf("A"); else if((grade >= 70)&&(grade < 85)) printf("B"); else if((grade >= 55)&&(grade < 70)) printf("C"); else if((grade >= 40)&&(grade < 55)) printf("D"); else printf("F"); }

Triangles #Include main() { int a,b; printf(“enter first side \n”); scanf(“%d”,&a); printf(“enter second side \n”); scanf(“%d”,&b ); printf(“enter third side \n”); scanf(“%d”,&c ); If((a==b)||(b==c)||(a==c)) { If ((a==b)&&(b==c)) printf(“Equilateral”); Else {printf( “ Isosceles”)};} Else {printf(“Scalene”)}; }

More Programs 4: Write a program which reads in a year and determines whether or not it is a leap year. Conditions for a leap year a) It is divisible by 4 b) If it is divisible by 100 then it is leap only if it is also divisible by 400 So 1600 and 2000 are leap years but 1900 isn't. 5: Write a program to read in a month and year and output how many days are in that month. 6: Read in the number which represents a day of the week, 01 is Sunday 02 is Monday etc and output in words what the next day is.

Leap Year #Include main() { int year; printf(“Enter Year \n”); scanf(“%d”,&year); if(year % 4 ==0 && (year % 100 != 0 ||year % 400 == 0)) printf( "The year is leap) else printf("The year is not leap”); }

No of Days in a month #Include main() { int days,month,year; printf(“Enter Month \n”); scanf(“%d”,&month); printf(“Enter Year \n”); scanf(“%d”,&year); days = 0; If (month == 2) { if(year % 4 ==0 && (year % 100 != 0 ||year % 400 == 0)) days = 29 else days = 28; } Else if((month == 4) ||(month == 6)||(month == 9)||(month == 11)) {days = 30;} Else {days = 31;}; printf (“the number of days in the month is %d”,days);}

Output the Following Day Note 1 = Sunday #Include main() { int day; printf(“Enter day \n”); scanf(“%d”,&day); if(day == 1) printf(“Monday”); else if(day == 2) printf(“Tuesday"); else if(day == 3) printf(“Wednesday"); else if(day == 4) printf(“Thursday"); else if(day == 5) printf(“Friday"); else if(day == 6) printf(“Saturday"); else printf(“Sunday"); }

Output the Following Day Note 1 = Sunday #Include main() { int day; printf(“Enter day \n”); scanf(“%d”,&day); if(day <= 4) {if (day <= 2) {if (day == 1) prinf(“Monday”) else printf(“Tuesday"); } else {if(day == 3) printf(“Wednesday"); else printf(“Thursday"); }} else { if(day < 6) printf(“Friday"); else if(day == 6) printf(“Saturday"); else printf(“Sunday"); }}