Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
0 of .
Results for:
P. 1
c Programs With Solutions-2

# c Programs With Solutions-2

Ratings: (0)|Views: 7|Likes:
programs for freshers with ouput solutions.
programs for freshers with ouput solutions.

### Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

02/20/2014

pdf

text

original

C PROGRAMS WITH SOLUTIONS- 2 NOTE: THIS ARE THE CONFIDENTAL AND INTERNAL PROGRAMS WITHOUTPUTS.C PROGRAMS FOR BEGINEERS(FRESHERS) FOR THE INTERVIEW POINT OFVIEW.
1.C program to perform arithemetic operations*/
#include<stdio.h>main(){int a,b;clrscr();printf("Enter value for a:");scanf("%d",&a);printf("/nEnter value for b:");scanf("%d",&b);printf("/n%d+%d=%d",a,b,a+b);printf("/n%d-%d=%d",a,b,a-b);printf("/n%dX%d=%d",a,b,a*b);printf("/n%d/%d=%d",a,b,a/b);}o/p:Enter value for a:5Enter value for b:25+2=75-2=35X2=105/2=2
2.
C program to calculate simple interest*/
#include<stdio.h>main(){float p,n,r,ci;clrscr();printf("Enter princiole :");scanf("%f",&p);printf("Enter Time Period:");scanf("%f",&n);printf("Enter Rate of Interest:");scanf("%f",&r);ci=(p*n*r)/100;printf("Simple Interest=%f",ci);}

o/p:Enter principle :5700.50Enter Time Period:1.6Enter Rate of Interest:2.5Simple Interest=228.020004
3.
C program to calculate Compound interest*/
#include<stdio.h>#include<math.h>main(){float p,n,r,ci,d;clrscr();printf("Enter principle :");scanf("%f",&p);printf("/nEnter Time Period:");scanf("%f",&n);printf("Enter Rate of Interest:");scanf("%f",&r);d=(1+r*0.10);ci=p*pow(d,n);printf("Simple Interest=%f",ci);}o/p:Enter principle :2000Enter Time Period:2Enter Rate of Interest:2Simple Interest=2880.000244
4.
Distance Travelled*/
#include<stdio.h>main(){float a,u,t,dis;clrscr();printf("\nEnter velocity, acceleration and time:");scanf("%f%f%f",&a,&u,&t);dis=(u*t)+(0.5*a*t*t);printf("Distance travelled=%f",dis);getch();}
5.
C program to convert Temparature From Faranheat To Celsiuls*/
#include<stdio.h>main(){float ft,ct;clrscr();

printf("Enter Faran Heat Temparature:");scanf("%f",&ft);ct=(ft-32)*5/9;printf("/ncelsius Temparature=%f",ct);}
6.
C program to convert Temparature From Celsius To Faranheat*/
#include<stdio.h>main(){float ft,ct;clrscr();printf("Enter celsius Temparature:");scanf("%f",&ct);ft=(ct*9/5)+32;printf("/nFaran Heat Temparature=%f",ft);}
7.
C program to calculate cube of the number*/
#include<stdio.h>main(){int a;clrscr();printf("Enter value for a:");scanf("%d",&a);printf("%d^3=%d",a,a*a*a);}o/p:Enter value for a:55^3=125
8.
*Swapping 2 nos Without Using Third Variable*/
#include<stdio.h>main(){int a,b;clrscr();printf("/nEnter values for a,b:");scanf("%d%d",&a,&b);printf("/nBefore swaping a=%d b=%d",a,b);a=a+b;b=a-b;a=a-b;printf("/nAfter swaping a=%d b=%d",a,b);getch();}o/p:

## Activity (3)

You've already reviewed this. Edit your review.