You are on page 1of 3

2.

CONVERSI ON OF TEMPREATURE

#include<iostream>

#include<stdio.h>

int main()

int i;

float c,f;

std::cout<<"enter 1 for c and 2 for f";

std::cin>>i;

switch(i)

case 1:

std::cout<<"enter the value of f";

std::cin>>f;

c=((32-f)/1.8);

std::cout<<"c="<<c;

break;

case 2:

std::cout<<"enter of value c";

std::cin>>c;

f=((1.8*c)+32);
std::cout<<"f="<<f;

break;

OUTPUT:

enter 1 for c and 2 for f

enter the value of f 24

c=4.44444

enter 1 for c and 2 for f

enter of value c15

f=59
1.AREA AND VOLUME SPHERE

#include<iostream>

int main()

int r;

float pie=3.14,volume,area;

std::cout<<"enter the value of r";

std::cin>>r;

area=4*pie*r*r;

volume=(4/3)*pie*r*r*r;

std::cout<<"area="<<area<<"volume="<<volume;

OUTPUT:

enter the value of r2;

area=50.24volume=25.12

You might also like