5.Find simple & compound Interest
#include<stdio.h>
#include<conio.h>
main()
{
float p,t,r,si,ci;//principal,time,rate of interest
clrscr();
printf("enter value of p,t,r\n");
scanf("%f%f%f",&p,&t,&r);
si= (p*t*r)/100;
ci= p* pow(1+r/100,t) -p;
printf("simple interest = %.2f\n",si);
printf("compound interest = %.2f\n",ci);
}
6.Swap values of 2 variables
i. use 3rd variable
ii. Donot use 3rd variable
iii.Swap in a single statement
i. use 3rd variable
#include <stdio.h>
#include<conio.>
main()
{
int a, b, temp;
printf("enter any 2 variables\n");
scanf("%d%d",&a,&b);
temp = a;
a = b;
b = temp;
printf("a=%d\n",a);
pritntf("b=%d", b);
getch();
}
ii. logic for donot using 3rd variable
a=a+b;
b=a-b;
a=a-b;
iiii.Logic for swapping in a single line
a= (a+b) - (b=a);
Note: for string swapping we must use only i method
0 comments
Post a Comment
Search
Add Link - Suggest Link - Submit URL Directory
EXOspy.com - free web directory
BlogUniverse
Free RSS Feeds Directory
Buy Text Links
Buy Text Links
http://2RSS.com/rss2html.php?rss_url=http://www.meetup.com/rss/g/science/32/new/
Buzz It!
Buzz It!
Buzz It!
|Buzz It!
EatonWeb Blog Directory
Submit url
Scrub The Web
|
|||
!tzalist Computers Directory
Fx1 web directory
Cluboo Web Directory
![]() Free Listing |
Best Free Domains
Web Hosting - ASP .NET Hosting
Free Hosting Directory
Free Image Hosting Directory
Free URL Forwarding

Top Stories Blogging Fusion Blog Directory
Shoula.com Search
# SgtSearch - Web Directory # SgtSearch - Web Directory # SgtSearch - Free Website Directory SearchWiz.org Directory Resource Central
Pharos Search Directory


