10 cls
11 c = 0
20 for n =1 to 10
30 input"enter no.";a
40 c=c+a
50 next n
60 print c
if (n%2==0) sum=n/2*(n+1); else sum=(n+1)/2*n;
Cls input "enter two no.s ",a,b sum=a+b print "sum = ";sum end
5
int sum (int min, int max) {return (max-min+1)*(max+min)/2;}
In Java, assuming you already created an array of int's, called myArray:int max = myArray[0];int sum = 0;for (int i = 0; i < myArray.length; i++){sum += myArray[i];if (myArray[i] > max)sum = myArray[i]}
It depends on the series.
You use the relevant formula.
//sum and product of 3 nos #include #include void main() { int a,b,c; printf("enter the 3 nos"); scanf("%d%d%d",&a,&b,&c); printf("sum of 3 nos",a+b+c); printf("product of 3 nos",a*b*c); getch(); }
The nos. Are 8 and -8 Sum of the nos. 8+(-8)=0 Product of the nos. 8 × (-8) = -64
148
Each one of them can be expressed as a sum of two primes.
-- Think of a name for the sum, like 'S'.-- Tell qbasic what 'S' is the sum of.S = 41 + 61 + 2 + 84 + 136-- If you want to see it on the screen, thenPRINT Sand the sum pops up. It looks like this on the screen:324
11x11
there cannot be any nos like that.. product of 2 odd nos is odd.. sum of two even nos is even.. that multiplied by six is even too.. subtracting 2 from that also gives an even no.. let x and y be the odd integers. according to the given question xy=6(x+y)-2..here we r actually equatin an odd no and an even no.. which is wrong.. so there cant be any two consecutive odd nos that fit in the question
777/3 = 259. So the numbers are 258, 259 and 260.
2 and 3.
if (n%2==0) sum=n/2*(n+1); else sum=(n+1)/2*n;