AD4BP

Write a programe for decide the entered year is leap year or not?

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

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

printf("Enter year:");
scanf("%d",&a);

if(a%4==0 && a%100==0)
{
printf("Year %d is leap year");
}

else
{
printf("Year %d is not leap year");
}
getch();
}



Write the programme for make simple calculator

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

void main()
{

char op;
int a,b;
float ans;

clrscr();

printf("first is :");
scanf("%d",&a);

printf("second is :");
scanf("%d",&b);

fflush(stdin);

printf("oprater:",op );
scanf("%c",&op);

if (op=='+')
{
ans=a+b;
printf("Answer=%f",ans);
}

else if (op=='-')
{
ans=a-b;
printf("Answer=%f",ans);
}

else if (op=='*')
{
ans=a*b;
printf("Answer=%f",ans);
}

else if (op=='%')
{
ans=a%b;
printf("Answer=%f",ans);
}

else if (op=='/')
{
if (a==0||b==0)
{
printf("Check your entry\n Mathematics Error");
}
else
{
ans=a/b;
printf("Answer=%f",ans);
}
}
getch();
}


Output:-

First is:(enter value)
Second is: (enter value)
Operator: (enter value)
Answer:



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



Write a programe convert Character into its ASCII value.

#include< stdio.h >
#include< conio.h >
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



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

#include< stdio.h >
#include< conio.h >
void main( )
{
int p;
float r;
clrscr( );
printf("\nEnter rupees= ");
scanf("%f",&r);
p=100*r;
printf("\nPaisa=%d",p);
getch( );
}



Write a programe for calculation of addition, sub, multy, div of given two number

#include< stdio.h >
#include< conio.h >
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( );
}



Write a programe for print your address in center of output screen.

#include< stdio.h >
#include< conio.h >
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( );
}



Write a programe for print "Hello World" in c language

#include< stdio.h >
#include< conio.h >
void main( )
{
int a;
clrscr( );
printf("Hello world");
getch( );
}


Output
Hello world



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;
}