0% found this document useful (0 votes)
43 views

#Include #Include Using Namespace STD

The document contains code for C++ programs that take user input, perform mathematical operations on the input like rounding or converting between Celsius and Fahrenheit, and output the results. The programs demonstrate the use of loops, input/output functions, and rounding/floor/ceil mathematical functions.

Uploaded by

s.r.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

#Include #Include Using Namespace STD

The document contains code for C++ programs that take user input, perform mathematical operations on the input like rounding or converting between Celsius and Fahrenheit, and output the results. The programs demonstrate the use of loops, input/output functions, and rounding/floor/ceil mathematical functions.

Uploaded by

s.r.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

#include <iostream>

#include <math.h>
using namespace std;

int main()
{
float i,j,k;
for(k=0; k<10; k++)
{
cout << "\nEnter a value" << endl;
cin>>i;
j= round(i);
cout<<"\nRounded value is\t"<<j<<endl;
}
return 0;
}

#include <iostream>
#include<math.h>

using namespace std;

int main()
{
float a, b, r, n;
int r_val;
cout<<"\nEnter the number of values!";
cin>>n;
for (int i=0; i<n; i++)
{
cout<<"Enter the value!\n";
cin>>a;
cout<<"Enter the value that you need
"<<a<<" to be divided by:\n";
cin>>b;
r=a/b;
r_val=round(r);
cout<<"\n/the rounded value
is:\t"<<r_val<<endl;
}
return 0;
}

Test Data
11
8848050 971-9112
3894971 215-18116
2952162 220-13419
11021 424-26
17043 1598-11
-1580606 -1687429-1
1687975 983-1717
-3495954 4461026-(-1)
12561 1112 11
18425 776 24
7533 570 13

FARENHEIT
#include <iostream>
#include <math.h>
using namespace std;

int main()
{
float f, c, n, i;
int r_val;
cout<<"\n Enter the number of values!";
cin>>n;
for(i=0; i<n; i++)
{
cout << "ENTER A NUMBER IN
FARENHEIT" << endl;
cin>>f;
c=(((f-32)*5)/9);
r_val= floor(c);
cout<<f<<" degree farenheit
is:\t"<<r_val<<" degree celsius";
}
return 0;
}

240 / 115
540 580 531 182 458 167 556 551 348 301
377 128 271 168 578 122 153 291 251 311
262 171 49 274 523 548 43 479 180
115

282
304
277
83

75
236

291
288

#include <iostream>
#include <math.h>
using namespace std;

int main()
{
float f, c, n, i;
int r_val;
cout<<"\n Enter the number of values!";
cin>>n;
for(i=0; i<n; i++)
{
cout << "ENTER A NUMBER IN
FARENHEIT" << endl;
cin>>f;
c=(((f-32)*5)/9);
r_val= ceil(c);
cout<<f<<" degree farenheit
is:\t"<<r_val<<" degree celsius";
}
return 0;
}

Use floor

175
149

191
53
132

75
303
50
67
143
121
155
127
77
9
134
272
286
6
248
82

You might also like