Sei sulla pagina 1di 13

/*Name:-Write a program to print a string in c language.

Author:-Sayyed Akeeb

Class:-FYMCA

RollNo:-44

Date:-28/08/15

*/

#include<stdio.h>

#include<conio.h>

void main()

clrscr();

printf("\nHello World");

getch();

Output:

/*Name:-Write a program to accept values of two numbers and print their addition.

Author:-Sayyed Akeeb
Class:-FYMCA

RollNo:-44

Date:-28/08/15

*/

#include<stdio.h>

#include<conio.h>

void main()

int a,b,c;

clrscr();

printf("Enter two numbers:\n");

scanf("%d%d",&a,&b);

c=a+b;

printf("Addition=%d",c);

getch();

Output:-
/*Name:-Write a program to accept values of two numbers and print their subtraction.

Author:-Sayyed Akeeb

Class:-FYMCA

RollNo:-44

Date:-28/08/15

*/

#include<stdio.h>

#include<conio.h>

void main()

int a,b,c;

clrscr();

printf("Enter two numbers:\n");

scanf("%d%d",&a,&b);

c=a-b;

printf("Subtraction=%d",c);

getch();

Output:-
/*Name:-Write a program to accept values of two numbers and print their multiplication in c
language.

Author:-Sayyed Akeeb

Class:-FYMCA

RollNo:-44

Date:-28/08/15

*/

#include<stdio.h>

#include<conio.h>

void main()

int a,b,c;

clrscr();

printf("Enter two numbers:\n");

scanf("%d%d",&a,&b);

c=a+b;

printf("Addition=%d",c);
getch();

Output:-

/*Name:-Write a program to accept values of two numbers and print their division in c
language.

Author:-Sayyed Akeeb

Class:-FYMCA

RollNo:-44

Date:-28/08/15

*/

#include<stdio.h>

#include<conio.h>

void main()

int a,b,c;

clrscr();

printf("Enter two numbers:\n");


scanf("%d%d",&a,&b);

c=a/b;

printf("Division=%d",c);

getch();

Output:-

/*Name:-Write a program to print area of circle.

Author:-Sayyed Akeeb

Class:-FYMCA

RollNo:-44

Date:-28/08/15

*/

#include<stdio.h>

#include<conio.h>

void main()

int c,r;
clrscr();

printf("Enter the radius:\n");

scanf("%d",&r);

c=3.142*r*r;

printf("Area of circle=%d",c);

getch();

Output:-

/*Name:-Write a program to print area of Triangle.

Author:-Sayyed Akeeb

Class:-FYMCA

RollNo:-44

Date:-28/08/15

*/

#include<stdio.h>

#include<conio.h>

void main()
{

int c,b,h;

clrscr();

printf("Enter the Base and Height:\n");

scanf("%d%d",&b,&h);

c=0.5*b*h;

printf("Area of Triangle=%d",c);

getch();

Output:-

/*Name:-Write a program to print simple interest.

Author:-Sayyed Akeeb

Class:-FYMCA

RollNo:-44

Date:-28/08/15

*/

#include<stdio.h>
#include<conio.h>

void main()

int p,n,r,si;

clrscr();

printf("\nEnter the Amount:");

scanf("%d",&p);

printf("\nEnter the Time:");

scanf("%d",&n);

printf("\nEnter the rate of Interest:");

scanf("%d",&r);

si=p*n*r/100;

printf("\nSimple Interest=%d",si);

getch();

Output:
/*Name:-Write a program to accept number from user and print its square and cube in c
language.

Author:-Sayyed Akeeb

Class:-FYMCA

RollNo:-44

Date:-28/08/15

*/

#include<stdio.h>

#include<conio.h>

void main()

int c,s,n;

clrscr();

printf("\nEnter the Number:");

scanf("%d",&n);

s=n*n;

c=n*n*n;

printf("\nSquare=%d\n",s);

printf("\nCube=%d",c);

getch();

Output:
/*Name:-Write a program to accept 2 values a & b and interchange their values in c language.

Author:-Sayyed Akeeb

Class:-FYMCA

RollNo:-44

Date:-28/08/15

*/

#include<stdio.h>

#include<conio.h>

void main()

int a,b,c;

clrscr();

printf("\nEnter the value of a:");

scanf("%d",&a);

printf("\nEnter the value of b:");

scanf("%d",&b);

c=a;
a=b;

b=c;

printf("\nAfter Swapping values are:");

printf("%d\t%d",a,b);

getch();

Output:

/*Name:-Write a program to accept 2 numbers and print largest among them in c language.

Author:-Sayyed Akeeb

Class:-FYMCA

RollNo:-44

Date:-28/08/15

*/

#include<stdio.h>

#include<conio.h>

void main()

{
int a,b,c;

clrscr();

printf("\nEnter the value of a:");

scanf("%d",&a);

printf("\nEnter the value of b:");

scanf("%d",&b);

if(a>b)

printf("\n%d is largest:",a);

else

printf("\n%d is largest:",b);

getch();

Output:

Potrebbero piacerti anche