#include
#include
using std::cin;
using std::cout;
using std::endl;
using std::string
int main()
{
const int numberOfdigits = 5;
string myNumber = "0";
char myNumberChar[numberOfdigits] = {0};
cout << endl << "Enter 4 digit integer: ";
cin >> myNumber;
int sumOfDigits = 0;
int temp = 0;
for (int arrayIndex = 0; arrayIndex < (numberOfdigits - 1); arrayIndex++)
{
temp = atoi(&myNumber.substr(arrayIndex, 1)[0]);
sumOfDigits += temp;
}
cout << endl << "Sum of 4 digits is: " << sumOfDigits << endl;
system("PAUSE");
return 0;
}
Peterson Number:145 = 1! + 4! + 5!number=sum of (factorials of digits)
#include <stdio.h> #include<conio.h> void main () { int a,r,n,sum=0; clrscr(); printf("enter the number"); scanf("%d",& n); c=n while (n!=0) { a=n%10; n=n/10; sum=sum*a+a } printf("the reverse is %d \n",sum); if(c==sum) printf("\n the given number is palindrome"); else printf("\n the given number is not a palindrome"); getch(); }
The sum of is the total of everything being summed; the sum total. Thus the sum of a, b and c is therefore a + b + c.
--THE SUM OF TWO NUMBERS: declare a number(2); b number(2); c number(2); begin a:=&a; b:=&b; c:=a+b; dbms_output.put_line(a ' + 'b' = 'c); end;
#include<stdio.h> #include<conio.h> void factor(int num) { int i,sum=0; for(i=1;i<num;i++) { if(num%i==0) { sum=sum+i; } } printf("Sum of the factor of %d is %d",num,sum); } void main() { int num; printf("Enter the number="); scanf("%d",&num); factor(num); getch(); }
4digit number
5295
It is 1,000.
9000
1000
kl
Let `a` be a rational number and `b` be an irrational number,assume that the sum is rational. 1.a +b =c Where a and c are rational and b is irrational. 2.b=c-a Subtracting the same number a from each side. 3.b is irrational c-a is a rational number we arrived at a contradiction. So the sum is an irrational number.
The sum of a rational and an irrational number is always irrational. Here is a brief proof:Let a be a rational number and b be an irrational number, and c = a + b their sum. By way of contradiction, suppose c is also rational. Then we can write b = c - a. But since c and a are both rational, so is their difference, and this means that bis rational as well. But we already said that b is an irrational number. This is a contradiction, and hence the original assumption was false. Namely, the sum c must be an irrational number.
(c+4)/2
A + b = c
Let your sum be a + b = c, where "a" is irrational, "b" is rational, and "c" may be either (that's what we want to find out). In this case, c - b = a. If we assume that c is rational, you would have: a rational number minus a rational number is an irrational number, which can't be true (both addition and subtraction are closed in the set of rational numbers). Therefore, we have a contradiction with the assumption that "c" (the sum in the original equation) is rational.
Peterson Number:145 = 1! + 4! + 5!number=sum of (factorials of digits)