Programming in C.

Slides:



Advertisements
Similar presentations
UNIONS IN C.  Union Data Type Union Data Type  Defining of Union Defining of Union  Memory Space Allocation Memory Space Allocation  Example of Union.
Advertisements

LEVEL-4. NOTE S System Define function #include void main() { int num; float r; clrscr(); printf(“Enter any no\n”); scanf(“%d”,&num); r=sqrt(num); printf(“root.
For Loop Lesson 3 CS1313 Spring for Loop Lesson 3 Outline 1. for Loop Lesson 3 Outline 2. for Loop with a float Counter: BAD! 3. float Counter Example.
Copyrights© 2008 BVU Amplify DITM Software Engineering & Case Tools Page:1 INTRODUCTION TO ‘C’ LANGUAGE Chapter 2.
Reading the data from the input devices and displaying the results on the screen are the two main tasks of any program. To perform these tasks user friendly.
How to start Visual Studio 2008 or 2010 (command-line program)
Dennis Ritchie 1972 AT & T Bell laboratories (American Telephone and Telegraph) USA 1www.gowreeswar.com.
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.
Example #include void main() { int a,b,c,n; clrscr(); printf("\nEnter the value of a,b:"); scanf("%d%d",&a,&b); printf("\nMENU"); printf("\n1.ADD\n2.SUB\n3.MULTIPLY\n0.EXIT");
範例:華氏  攝氏 #include /* print Fahrenheit-Celsius table for fahr = 0, 20,..., 300 */ main() { int fahr, celsius; for(fahr = 0; fahr
Struct 1. Definition: Using struct to define a storage containing different types. For example it can contain int, char, float and array at the same time.
Definition of function Types of Function Built-in User Defined Catagories of Function No argument No return value Argument but No return value No argument.
Circumference Review. Review What is the relationship between a radius and a diameter? What does a circumference measure? What formulas do we use to calculate.
Decision Making It is used to change the order of the program based on condition. Categories: – Sequential structure – Selection structure – Iteration.
Special Factoring. Difference of Squares General Formula: (x) 2 – (y) 2 = (x + y)(x – y)
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 TOPICS TO DISCUSS : FUNCTIONS TYPES OF FUNCTIONS HEADER FILES PRESENTED BY : AVISHEK MAJUMDAR(837837) GUNJAN AGARWAL(856587) SATYAPRIYA DEY(856624)
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.
5.3 Notes – Add, Subtract, & Multiply Polynomials.
Starter Questions 21/02/11 1. Calculate the circumference 15cm
Arithmetic Expressions
CSE101-Lec#5-6 Operators.
CS1001 Programing Fundamental Lecture 5 Top-Down Design with Functions
Computer Science 210 Computer Organization
Zhang Hongyi CSCI2100B Data Structures Tutorial 3
Circles: Circumference & Area
Unit VI- Selection – Making Decisions, Repetition
6.7 Circumference and Arc Length.
Input/output.
ICS103 Programming in C Lecture 10: Functions II
C Programming Tutorial – Part I
FUNCTIONS.
Circles.
Functions in C Mrs. Chitra M. Gaikwad.
مبانی کامپیوتر و برنامه سازی
2008/11/10: Lecture 16 CMSC 104, Section 0101 John Y. Park
Circles: Circumference & Area
Area of Circles TeacherTwins©2014.
מבוא כללי למדעי המחשב תרגול 2
Computer Science 210 Computer Organization
Introduction to Programming
Circles… SOL 6.12 Mrs. Norman John Rolfe Middle School.
Spiral TAKS Review #2 6 MINUTES.
Circumference Definition: The distance around a circle. It’s a special word for perimeter. Picture:
توابع ورودي-خروجي.
CSCE 206 Lab Structured Programming in C
Functions, Part 2 of 3 Topics Functions That Return a Value
for Loop Lesson 3 Outline
Notes Over 3.7 Solve for the indicated variable. 1. Area of a Triangle.
The properties of a circle and how you can identify it.
Functions.
Finding area of circle using circumference
What fraction of the whole circle is this sector?
Circumference and Arc Length. Circumference and Arc Length.
Character Arrays char string1[] = “first”;
ICS103 Programming in C Lecture 10: Functions II
11 Chapter Introductory Geometry
Computer Security Password Policy.
Circumference C = 2pr or pd. Circumference C = 2pr or pd.
CSCE 206 Lab Structured Programming in C
Topic: How to calculate the area of a circle.
Essential Questions: Standards:
Area of Circle.
Lecture 8.
CSCE 206 Lab Structured Programming in C
Functions, Part 2 of 3 Topics Functions That Return a Value
6-лекция Турбо Си тілі элементтері.
ICS103 Programming in C Lecture 10: Functions II
Functions, Part 2 of 3 Topics Functions That Return a Value
Presentation transcript:

Programming in C

#include <stdio.h> #include <conio.h> Program to find an area and circumference of an area #include <stdio.h> #include <conio.h> #include <math.h> int main() {int r; float pi=3.14, area,ci; printf("enter radius:"); scanf("%d", &r); //area=pi*r*r; area=pi*(pow(r,2)); printf("area of circle =%f \n ", area); ci=2*pi*r; printf(" circumference =%f",ci); getch(); }

scanf("%d%d%d",&p,&r,&t); si=(p*r*t)/100; Program to find the simple interest int p,r,t,si; printf("eneter principle, rate of interest & time to find simple interest: \n"); scanf("%d%d%d",&p,&r,&t); si=(p*r*t)/100; printf("simple interest=%d",si); getch();

printf("enter marks of 5 subjects:"); Program to calculate sum of 5 subjects and find percentage int s1,s2,s3,s4,s5,sum,total=500; float per; printf("enter marks of 5 subjects:"); scanf("%d%d%d%d%d",&s1,&s2,&s3,&s4,&s5); sum=s1+s2+s3+s4+s5; printf("sum=%d \n",sum); per=(sum*100)/total; printf("percentage =%f",per);

printf("eneter value of a&b: \n"); scanf("%d%d",&a,&b); a=a+b; b=a-b; Program to swap two numbers without using a third variable int a,b; printf("eneter value of a&b: \n"); scanf("%d%d",&a,&b); a=a+b; b=a-b; a=a-b; printf("after swapping the value of a&b:%d\n%d",a,b);