C program report tips

Post on 20-Jul-2015

49 views 5 download

Transcript of C program report tips

MAKE A \FLOW CHARTOF SIMPLELEL

BlUE BRD COLLEGE

Kumaripati, Lalitpur

Ph: 5555142

Project work of computer

Submitted by submitted to

Er. Hari Prasad ghimire

Name: Nirmala jaishi. . .. . . . . . .. .. .

Class: xii

Roll no.: 25. .. ..

Sec:” B”

ESTD :2004

MAKE A \FLOW CHARTOF SIMPLELEL

Acknowledgement:

I acknowledge all those who contributed to the preparation of this project

The extensibe work of preparing this project would not have been possible without the help of my teacher and difference type of reference materials

I thank to my principal and my computer teacher

For providing me the opportunity to prepare this work

MAKE A \FLOW CHARTOF SIMPLELEL

C PROGRAMMING

INTRODUCTON OF C PROGRAMMING

C Programming is a structure oriented programming language which was developed dennnis Ritchie in 1972 at bell liboratory in USA this language is high level language like English language for the development of different software and application

software c programming language is also develop c++ programming language using platform it support compiler or interpreter for hardware interfacing or different

electronic device like as for developing robotics and export syste

ADVANTAGES OF C PROGRAMMMING1

The advantages of c prorammming are as follows:

1)It is easier interact with hardware

2)It is easy to run

3)program code is secured

4)It is compact can easier

DISADVANTAGES OF C PROGRAMMING

The disadvantages of c programming are as follows:

1)It does not contain run time error

2)There is no strict type of checking

3)it is difficult to fix bug.

1

MAKE A \FLOW CHARTOF SIMPLELEL

Decision statements (If-else):

Looping or Iteration statements:

Some of the calculations done using C programming Language:

A program to print sum of two numbers.

Algorithm:

Step 1: Start.

Step 2: Initialize variable a, b and sum=0.

Step 3: Input for a and b.

Step 4: Calculate sum=a+b.

Step 5: Display result sum..

Step 6: End.

Flow Chart:

Start

Initialize a,b,sum=0

Input a & b

Sum=a+b

Display result sum

Stop

MAKE A \FLOW CHARTOF SIMPLELEL

Source code:

#include<stdio.h>

#include<conio.h>

Void main ()

{

Int a, b, sum=o;

Clrscr();

Printf(“Enter two number:\n”);

Scanf(“%d%d”,&a,&b);

sum=a+b;

Printf(“The sum of two number is:%d”,sum);

Getch();

}

Output:

Enter two number:

12,15

The sum of two number is:27

A program to print Simple Interest.

Algorithm:

Step 1: Start.

Step 2: Initialize variable p, t, r, Si=0.

Step 3: Input for p, t and r.

Step 4: Si=(p*t*r)/100.

Step 5: Display result.

Step 6: End.

MAKE A \FLOW CHARTOF SIMPLELEL

Flow Chart:

Source code:

#include<stdio.h>

#include<conio.h>

Void main ()

{

float p, t, r, si=0;

Clrscr();

Start

Initialize p,t,r,si=0

Input p, t, r

Si=(p*t*r)/100

Display result Si

Stop

MAKE A \FLOW CHARTOF SIMPLELEL

Printf(“Enter Principle, Time, Rate:\n”);

Scanf(“%f%f”,&p,&t,&r);

si=(p*t*r)/100;

Printf(“The Simple interest is:%f”,si);

Getch();

}

Output:

Enter Principle, Time, Rate:

200,12,10

The Simple interest is:

A program to print conversion of temperature from centigrade to farhenite.

Algorithm:

Step 1: Start.

Step 2: Initialize variable c,f.

Step 3: Input for c.

Step 4: f=(0.55*c)+32.

Step 5: Display result.

Step 6: End.

Flow Chart:

Start

Initialize c,f

MAKE A \FLOW CHARTOF SIMPLELEL

Source code:

#include<stdio.h>

#include<conio.h>

Void main ()

{

floatc,f;

Clrscr();

Printf(“Enter centigrade:\n”);

Scanf(“%f”,&c);

f=(0.55*c)+32;

Printf(“The farenheit is:%f”,f);

Getch();

}

Output:

Enter centigrade:

The farenheit is:

A program to print greatest number among three numbers.

Algorithm:

Input c

f=(0.55*c)+32

Display result

Stop

MAKE A \FLOW CHARTOF SIMPLELEL

Step 1: Start.

Step 2: Initialize variable a, b, c.

Step 3: Input for a,b,c.

Step 4: If (a>b), and if (a>c) then a is greater. Else c is greater.

Step 5: else if (b>c) then b is greater

Step: Display greatest number..

Step: End.

Flow Chart:

T F

Source code:

#include<stdio.h>

#include<conio.h>

Void main ()

{

Start

Initialize a, b, c

Input c

Stop

If

(a>b))

If

(a>c))

If

(b>c))

a is greater.

c is greater. c is greater. b is greater.

MAKE A \FLOW CHARTOF SIMPLELEL

Int a, b, c;

Clrscr();

Printf(“Enter Three number:\n”);

Scanf(“%d%d%d”,&a,&b,&c);

If (a>b)

{

Else if (a>c)

{

Printf(“a is greater.”);

}

Else

{

Printf(“c is greater.”);

}

Else if (“b>c”)

{

Prinf(“b is greater.”);

}

Else

{

Printf(“c is greater.”);

}

Getch(); }

}

Output:

Enter Three number:

(a is greater.) Or (b is greater.) Or (c is greater.)

MAKE A \FLOW CHARTOF SIMPLELEL

Lab report – 2

A program to print sum of natural numbers from 1 to 50.

Source code:

#include<stdio.h>

#include<conio.h>

Void main ()

{

Inti,sum=0;

Clrscr();

For (i=1; i<=50; i++);

sum=sum+i;

Printf(“The sum of natural number from 1 to 50 is:%d”,sum);

Getch();

}

Output:

The sum of natural number from 1 to 50 is:

A program to find given input number is even or odd.

Source code:

#include<stdio.h>

#include<conio.h>

Void main ()

{

Intn,i,sum=0;

Clrscr();

Printf(“Enter a number to check whether it is even or odd:\n”);

Scanf(“%d”,&n);

If (n%2==0)

{

Printf(“The given number is even.”);

MAKE A \FLOW CHARTOF SIMPLELEL

}

Else

{

Printf(“The given number is odd.”);

}

Getch();

}

Output:

The given number is even.

The given number is odd.

A program to print sum of even numbers from 0 to 100.

Source code:

#include<stdio.h>

#include<conio.h>

Void main ()

{

Inti,sum=0;

Clrscr();

For (i=0; i<=100; i+2);

{

sum=sum+i;

}

Printf(“The sum of even number from 0 to 100 is:%d”,sum);

Getch();

}

Output:

The sum of even number from 0 to 100 is:

MAKE A \FLOW CHARTOF SIMPLELEL

A program to print sum of odd numbers from 1 to 100.

Source code:

#include<stdio.h>

#include<conio.h>

Void main ()

{

Inti,sum=0;

Clrscr();

For (i=1; i<=100; i+2);

{

sum=sum+i;

}

Printf(“The sum of odd number from 0 to 100 is:%d”,sum);

Getch();

}

Output:

The sum of odd number from 0 to 100 is:

Conclusion:

I want to conclude that, using above all codes many program can be made which makes user to write program in simple and easy way. C programming language has made new technologies evolve.

THE END