AD4BP

Write a c programe to decide given no is armstrong or not?.

#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();
}

Write program for find the area of circle.

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

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

Output:-
Enter radious of circle:
Area of circle:

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