C language Programe

May 11, 2017 | Author: njpatel9 | Category: N/A
Share Embed Donate


Short Description

Basic Programes related to c language...

Description

For Download More Visit http://www.nectarkunj.webs.com/

PROGRAME:-1 Write a programe for following output.

Output:Hello world

Input:#include #include void main( ) { int a; clrscr( ); printf("Hello world"); getch( ); }

PROGRAME:-2 Write a programe for following output.

Output:Hello worldHow are you?

Input:#include #include void main( ) { int a; clrscr( ); printf("Hello world"); printf("How are you?"); getch( ); }

PROGRAME:-3 Write a programe for following output.

Output:Hello worldHow are you?

Input:#include Visit http://programeansic.blogspot.com

For Download More Visit http://www.nectarkunj.webs.com/

#include void main( ) { int a; clrscr( ); printf("Hello world"); printf("\nHow are you?"); getch( ); }

PROGRAME:-4 Write a programe for following output.

Output:Hello world

How are you?

Input:#include #include void main( ) { clrscr( ); printf("Hello world"); printf("\tHow are you?"); getch( ); }

PROGRAME:-5 Write a programe for print your address in center of output screen.

Input:#include #include void main( ) { clrscr( ); printf("\n\t\t\tPatel Ankit"); printf("\n\t\t\t12\Sardar Bunglows"); printf("\n\t\t\tShivaji chowk, Shahibagh"); printf("\n\t\t\tAhmedabad"); getch( ); }

Visit http://programeansic.blogspot.com

For Download More Visit http://www.nectarkunj.webs.com/

Output:Output will be print in centre of screen.

PROGRAME:-6 Write a programe for calculation of addition, sub, multy, div of given

two number. Input:#include #include void main( ) { int a,b,c; float d; clrscr( ); printf("Enter first no: "); scanf("%d",&a); printf("Enter second no: "); scanf("%d",&b); c=a+b; printf("\nAddition=%d",c); c=a-b; printf("\nSubstraction=%d",c); c=a*b; printf("\nMultiplication=%d",c); c=a%b; printf("\nModulow=%d",c); d=a/b; printf("\nDivision=%2.2f",d); getch( ); }

Output:Enter first no: 50 Enter second no: 4 Addition=54 Substraction=46 Multiplication=200 Modulow=2 Division=12

PROGRAME:-7 Visit http://programeansic.blogspot.com

For Download More Visit http://www.nectarkunj.webs.com/

Write a programe convert rupees into paisa.Note: -1 rupee=100 paisa.

Input:#include #include void main( ) { int p; float r; clrscr( ); printf("\nEnter rupees= "); scanf("%f",&r); p=100*r; printf("\nPaisa=%d",p); getch( ); }

Output:Enter rupees= 4.4 Paisa=440

PROGRAME:-8 Write a programe convert Character into its ASCII value.

Input:#include #include void main( ) { char c; clrscr( ); printf("Enter Character: "); scanf("%c",&c); printf("Character %c 's ASCII no=%d",c,c); getch( ); }

Output:Enter Character: N Character N 's ASCII no=78

PROGRAME:-9 Visit http://programeansic.blogspot.com

For Download More Visit http://www.nectarkunj.webs.com/

Write a programe convert ASCII no into related character.

Input:#include #include void main( ) { int n; clrscr( ); printf("Enter ASCII no:"); scanf("%d",&n); printf("ASCII no %d is for character %c",n,n); getch( ); }

Output:Enter ASCII no:97 ASCII no 97 is for character a

PROGRAME:-10 Write a programe for find area of circle by given radius .

Input:#include #include void main( ) { float r,a; clrscr( ); printf("Enter radius of circle: "); scanf("%f",&r); a=3.14*r*r; printf("Area of circle=%2.2f",a); getch( ); }

Output:Enter radius of circle: 3 Area of circle=28.26

PROGRAME:-11 Write a programe for find diagonal of rectangle by length & width. Visit http://programeansic.blogspot.com

For Download More Visit http://www.nectarkunj.webs.com/

Input:#include #include #include void main( ) { int a,b; float c; clrscr( ); printf("Enter length of rectangle:"); scanf("%d",&a); printf("Enter width of rectangle:"); scanf("%d",&b); c=sqrt(a*a+b*b); printf("Daigonal of ractangle=%f",c); getch( ); }

Output:Enter length of rectangle:4 Enter width of rectangle:3 Daigonal of ractangle=5.000000

PROGRAME:-12 Write a programe for calculate simple interest.

Input:#include #include void main( ) { int p,n; float r,i; clrscr( ); printf("Enter Value of p: "); scanf("%d",&p); printf("Enter Value of n: "); scanf("%d",&n); printf("Enter Value of r: "); scanf("%f",&r); i=p*r*n/100; printf("Interest=%5.2f",i); getch( ); }

Output:Visit http://programeansic.blogspot.com

For Download More Visit http://www.nectarkunj.webs.com/

Enter Value of p: 10000 Enter Value of n: 3 Enter Value of r: 10.00 Interest=3000.00

PROGRAME:-13 Write a programe swap two number without using third variable .

Input:#include #include void main( ) { int a,b; clrscr( ); printf("Enter value of a: "); scanf("%d",&a); printf("Enter value of b: "); scanf("%d",&b); a=b-a; b=b-a; a=a+b; printf("\nValue of a:%d",a); printf("\nValue of b:%d",b); getch( ); }

Output:Enter value of a: 25 Enter value of b: 36 Value of a:36 Value of b:25

PROGRAME:-14 Write a programe swap two number with using third variable .

Input:#include #include void main( ) { int a,b,c; clrscr( ); Visit http://programeansic.blogspot.com

For Download More Visit http://www.nectarkunj.webs.com/

printf("Enter value of a: "); scanf("%d",&a); printf("Enter value of b: "); scanf("%d",&b); c=a; a=b; b=c; printf("\nValue of a:%d",a); printf("\nValue of b:%d",b); getch( ); }

Output:Enter value of a: 5 Enter value of b: 9 Value of a:9 Value of b:5

PROGRAME:-15 Write a programe convert temperature celcious into fahrenheit.

Input:#include #include void main( ) { float c,f; clrscr( ); printf("Enter temperature in Celcious: "); scanf("%f",&c); f=1.8*c+32; printf("\nTemperature in Fahrenheit=%2.2f",f); getch( ); }

Output:Enter temperature in Celcious: 25 Temperature in Fahrenheit=77.00

PROGRAME:-16 Write a programe convert temperature Fahrenheit into calcious. Visit http://programeansic.blogspot.com

For Download More Visit http://www.nectarkunj.webs.com/

Input:#include #include void main( ) { float c,f; clrscr( ); printf("Enter temperature in Fahrenheit: "); scanf("%f",&f); c=(f-32)/1.8; printf("\nTemperature in Calcious=%2.2f",c); getch( ); }

Output:Enter temperature in Fahrenheit: 98 Temperature in Calcious=36.67

PROGRAME:-17 Write a programe for decide entered no is odd/even.

Input:#include #include void main( ) { int n,a; clrscr( ); printf("Enter Number:"); scanf("%d",&n); a=n%2; if(a==0) { printf("%d is Even number",n); } else { printf("%d is Odd number",n); } getch( ); }

Output:Visit http://programeansic.blogspot.com

For Download More Visit http://www.nectarkunj.webs.com/

Enter Number:95 95 is Odd number

Visit http://programeansic.blogspot.com

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF