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
In QBASIC, you can write a simple program to input the number 64751315 and sum its digits as follows: DIM sum AS INTEGER sum = 0 INPUT "Enter a number: "; number FOR i = 1 TO LEN(number) sum = sum + VAL(MID$(number, i, 1)) NEXT PRINT "The sum of the digits is "; sum This program prompts the user to input a number, iterates through each digit, converts it to an integer, and adds it to the total sum, which is then printed out.
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;}
It depends on the series.
//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(); }
You use the relevant formula.
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
In QBASIC, you can write a simple program to input the number 64751315 and sum its digits as follows: DIM sum AS INTEGER sum = 0 INPUT "Enter a number: "; number FOR i = 1 TO LEN(number) sum = sum + VAL(MID$(number, i, 1)) NEXT PRINT "The sum of the digits is "; sum This program prompts the user to input a number, iterates through each digit, converts it to an integer, and adds it to the total sum, which is then printed out.
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
11x11
777/3 = 259. So the numbers are 258, 259 and 260.
2 and 3.