C, DS and More..

This site gives about c and data structures information

Make Money

Labels

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

Submit Your Site To The Web's Top 50 Search Engines for Free! Copy the Highlighted Code to your Web Page: Submit Your Site To The Web's Top 50 Search Engines for Free! Top Free Directories Search Engine Optimization - AddMe Search Engine Submission and Optimization
Submit your website to 20 Search Engines - FREE with ineedhits!
Free Weblog Directory Computers Buzzer Hut | Promote Your Blog Promote Your Blog Free Blog Directory - Submit Your Blog Here href="http://www.superblogdirectory.com/">Superblog Directory Free Blog Directory Add Link - Suggest Link - Submit URL Directory EXOspy.com - free web directory BlogUniverse Free RSS Feeds Directory

Get more backlinks - Free Directory Submission

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! | GeoURL http://rpc.technorati.com/rpc/ping http://sorayacity.blogspot.com/ http://janetjohn111203.blogspot.com/ blogarama - the blog directory
EatonWeb Blog Directory Submit url
Scrub The Web:    
Scrub The Web

SearchSight.com

"Changing the Way that the World Looks at the Internet!"

Free Website Directory 123 Kidz Area.com < /a > Free Web Directory | Paid Web Directory | Web Directory Submission | Internet Web Directory | Add URL The Poddys Art And Photography Directory Website Directory !tzalist Computers Directory Fx1 web directory Cluboo Web Directory

Free Listing
Isins Quality Web Site Directory SirPac SEO Internet Web Directory - Add Your URL for Free Resource Central Free web directory Top sites India pingoat_13.gif

SEO Expert

HubShout.com

Best Free Domains Web Hosting - ASP .NET Hosting Free Hosting Directory Free Image Hosting Directory Free URL Forwarding Listed in LS Blogs the Blog Directory and Blog Search Engine My Zimbio
Top Stories Blogging Fusion Blog Directory Blog Directory

Shoula.com Search

# SgtSearch - Web Directory # SgtSearch - Web Directory # SgtSearch - Free Website Directory SearchWiz.org Directory Resource Central Pharos Search Directory Pharos Search Directory oneMission Osy-Directory.com The Blog Directory GeekySpeaky: Submit Your Site! Blog Directory FindingBlog - Blog Directory Directory of Computers/Tech Blogs blogBunch : the best blogs online All-Blogs.net directory Blogz

Make Money

Blog Archive

Shout Here


Free chat widget @ ShoutMix