You are on page 1of 4

SUM ODD EVEN

#include "stdafx.h"
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main()
{
int EVEN=0;
int ODD=0;
int number;
int i;

for (i=1;i<=10;i++)
{
cout << "enter a number:";
cin >> number;

if (number%2==0)
{
EVEN=EVEN+number;
}
else
{
ODD=ODD+number;
}
}
cout << "display sum of EVEN:" << EVEN << endl;
cout << "display sum of ODD:" << ODD << endl;

return 0;
}
















SIMPLE CALCULATOR

#include "stdafx.h"
#include <cmath>
#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
float fN, sN, result;
char oP;

cout<< "first number:";
cin>> fN;
cout<< "second number:";
cin>> sN;
cout<< "operator:";
cin>> oP;
switch (oP)
{
case '+': result = fN + sN;
break;
case '-': result = fN - sN;
break;
case '*': result = fN * sN;
break;
case '/': if(!(sN==0))
result = fN / sN;
break;
case 'm': result = int(fN) % int(sN);
break;

default: cout<<"invalid";
}
cout<< "result:" << result;
return 0;
}
















TEMPARATURE

#include "stdafx.h"
#include<iostream>
using namespace std;

int main()
{

float fah, celsius;

cout << "Enter Temperature in Farenheit: ";
cin >> Fah;

celsius = (float (5.0) / float (9.0)) * (fah - float (32));
cout << "The product is " << celsius << endl;

return 0;
}

























PREFINAL

#include "stdafx.h"
#include <iostream>
using namespace std;

void convertBill(int, int&, int&, int&, int&, int&, int&);
int main()
{
int peso, hundreds, fifties, twenties, tens, fives, ones;

cout<< "BILL CONVERSION ";
cout<< "Amount in Peso:";
cin>> peso;
convertBill(peso, hundreds, fifties, twenties, tens, fives, ones);
cout<< "hundreds:"<<hundreds<<endl;
cout<< "fifties:"<<fifties<<endl;
cout<< "twenties:"<<twenties<<endl;
cout<< "tens:"<<tens<<endl;
cout<< "fives:"<<fives<<endl;
cout<< "ones:"<<ones<<endl;
return 0;
}
void convertBill(int peso, int& hundreds, int& fifties, int& twenties, int&
tens, int& fives, int& ones)

{
hundreds= 500/100;
fifties= 50/50;
twenties= 20/20;
tens= 10/10;
fives=5/5;
ones=1/1;
}

You might also like