AD4BP

For fuction x^2-5

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

void fun(int);

void main()
{
int n;
clrscr();

printf("Enter no for calculation:");
scanf("%d",&n);

fun(n);

getch();
}

void fun(int n)
{
int r;
r=n*n-5;

printf("%d",r);
}

Pointer 1

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

void exchange(int *,int *);

void main()
{

int a,b;
clrscr();

printf("Enter vale of a & b:");
scanf("%d %d",&a,&b);

exchange(&a,&b);

printf("a=%d",a);
printf("b=%d",b);

getch();
}

void exchange(int *p,int *q)
{
int *k;
*k=*p;
*p=*q;
*q=*k;
}

Armstrong number

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

void main()
{

int a,b,sum=0,n;
clrscr();

printf("enter no:");
scanf("%d",&n);

b=n;

while(n>0)
{
a=n%10;
sum=sum+(a*a*a);
n=n/10;
}

if(b==sum)
{
printf("Armstrong no");
}
else
{
printf("Not Armstong no");
}

getch();
}

Programe:-8

Programe:-8

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

Output:-
Enter lenth of rectangle:__
Enter width of rectcngle:__
Daigonal of rectangle=__

Program:-16

Program:-16

Aim:-Write program for enter marks of five subject & find class of given percentage.
Input:-
#include< stdio.h >
#include< conio.h >

void main( )
{
int a,b,c,d,m,y;
clrscr( );

printf("Enter days=");
scanf("%d",&a);

y=a/365;
b=a%365;
m=b/30;
c=b%30;
d=c;

printf("\nYears:%d",y);
printf("\nMonths:%d",m);
printf("\nDays:%d",d);

getch( );
}
Output:-

Program:-15

Program:-15

Aim:-Write program for enter marks of five subject & find class of given percentage.
Input:-
#include< stdio.h >
#include< conio.h >
void main( )
{
int a,b,c,d,e;
float p;
clrscr( );

printf("Enter marks of Maths:");
scanf("%d",&a);

printf("Enter marks of Phy:");
scanf("%d",&b);

printf("Enter marks of Che:");
scanf("%d",&c);

printf("Enter marks of English:");
scanf("%d",&d);

printf("Enter marks of Computer:");
scanf("%d",&e);

p=(a+b+c+d+e)*100/500;

printf("Percentage: %5.2f%\n",p);

if(p<=100 &&p>=70)
{
printf("Destiction");
printf("\nCongratulation");
}
else if(p<70 &&p>=60)
{
printf("First class");
printf("\nCongratulation");
}

else if(p<60 &&p>=50)
{
printf("Second class");
printf("\nCongratulation");
}

else if(p<50 &&p>=35)
{
printf("Third class");
printf("\nCongratulation");
}

else if(p<35)
{
printf("Fail");
}

else
{
printf("Check your Entery");
}

printf("\nThank you \n Bye");
getch( );
}
Output:-

Write program for print college Address.

Input:-
#include < stdio.h >
#include < conio.h >
void main( )
{
clrscr( );
printf("\n\t\t\tWelcome");
printf("\n\t\t\t To");
printf("\n\t\t\tIndus Institute of Technology");
printf("\n\t\t\tRancharada, Ahmedabad");
getch( );
}


Output:-
Welcome
To
Indus Institute of Technology
Rancharada, Ahmedabad