C program to calculate simple interest.
# include<stdio.h>
void main()
{
float p, t, r, si;
printf("Enter P T R ");
scanf("%f%f%f",&p,&t,&r);
si=(p*t*r)/100;
printf("\n Simple Interest is %f", si);
}
Output:
Enter P T R
100 5 5 [Enter Key]
Simple Interest is
25.00
C program to calculate area and perimeter of rectangle.
# include<stdio.h>
void main()
{
float l, b, area, per;
printf("Enter length and breadth of rectangle ");
scanf("%f%f", &l, &b);
area=l*b;
per=2*(l+b);
printf("\n Area of rectangle is %f", area);
printf("\n Perimeter rectangle is %f", per);
}
Output:
Enter length and breadth of rectangle
10 20 [Enter Key]
Area of rectangle is 200.00
Perimeter of rectangle is 60.00
C program to check for PALINDROME or not.
# include<stdio.h>
void main()
{
int n, rem, rev=0, temp;
printf("Enter a number to be check ");
scanf("%d",&n);
temp=n;while (n!=0)
{rem=n%10;rev=(rev*10)+rem;n=n/10;}
if (rev==temp)printf("\n PALINDROME");
elseprintf("\n NOT Palindrome ");
}
Output:
Enter a number to be check
123NOT Palindrome
# include<stdio.h>
void main()
{
int n, rem, rev=0, temp;
printf("Enter a number to be check ");
scanf("%d",&n);
Output:
No comments:
Post a Comment