Skip to content
Snippets Groups Projects
Commit 5cb489fc authored by Ross Netusil's avatar Ross Netusil
Browse files

Start_my_repo

parents
Branches
No related tags found
No related merge requests found
#include <iostream>
int main ()
{
int i;
std::cout << "please enter an integer value: ";
std::cin >> i;
int b=i;
int a;
for (int a=b-1; a!=0; b=b*a--);
std::cout << "The value you entered is " << i;
std::cout << " and its factorial is " << b << ".\n";
return 0
;}
#include <iostream>
int main ()
{
int i;
std::cout << "please enter an integer value: ";
std::cin >> i;
int b=i;
int a;
for (int a=b-1; a!=0; b=b+a--);
std::cout << "The value you entered is " << i;
std::cout << " and the sum of all whole numbers up to and including your value is " << b << ".\n";
return 0
;}
#include <iostream>
int main ()
{
int i;
std::cout << "please enter an integer value: ";
std::cin >> i;
int b=i;
int a=b-1;
while (a >= 1) {
b += a--;}
std::cout << "The value you entered is " << i;
std::cout << " and the sum of all whole numbers up to and including your value is " << b << ".\n";
return 0
;}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment