Discussions Q&R
Write a python program which will ask user to enter 3 numbers. Your program will output the sum and average of these 3numbers.your program will also output the largest number, the smallest number of these three. For exampleif user enter 2,10,3 than your program will output,
For number 2,10,3 sum is 15,average is 5,the largest number is 10 and the smallest number is 2.
2 Votes
10 Réponsesi want to print sum of all integers from 1to 100 like for example :
1
3
6
10
15......
i tried it i know my code is wrong please help me class Program {
public static void main(String[] args) {
for(int x = 1; x <101; x++) {
int sum = int x;
System.out.println("1");
System.out.println("sum");
}
}
}
3 Votes
11 RéponsesI have 10 variables called, int1, int2, int 3 and so on. The user can write one number into the console. If the user types 7, I want to add 3 to the value of int7. how do I do this without 10 if statements? can I somehow do something like, (int + "userinput") += 3?
thank you for your help! :D
0 Vote
2 RéponsesWrite a python program which will ask user to enter 3 numbers. Your program will output the sum and average of these 3numbers.your program will also output the largest number, the smallest number of these three. For exampleif user enter 2,10,3 than your program will output,
For number 2,10,3 sum is 15,average is 5,the largest number is 10 and the smallest number is 2.
-1 Vote
4 RéponsesCan anyone help me to code this
Write a method 'timesTable()' which accepts an integer value num from the keyboard and uses it to print 'times table' of itself in a structured format. Your output must include a header row. For example, if the user enters 5, your program's output should be:
5 Times Table
1 5 5
2 5 10
3 5 15
4 5 20
5 5 25
6 5 30
0 Vote
5 Réponses
what have i to do, if i want that the program always writes for example :
0+1
1+2
3+3
6+4
10+5
15+6
...
because now it just writes
1
3
6
10
15
...
and maybe if it works, can i make then
0+1=1
1+2=3
3+3=6
6+4=10
#include <iostream>
using namespace std;
int main(){
int i;
int sum = 0;
for (i = 1; i <= 100; i++){
sum = sum+i;
cout<<sum<<endl;
}
cout<<sum;
return 0;
}
1 Vote
5 Réponsesdef add(x, y):
return x + y
def do_twice(func, x, y):
return func(func(x, y), func(x, y))
a = 5
b = 10
print(do_twice(add, a, b))
Please explain step by step
Which is caller here?
Explain the 3rd and 4th line ?
why in 4th line we write add(add(x,y),add(x,y)) which is function of 1st line ?
how can we write function after return statement insted of (x+y+x+y )=30?
0 Vote
2 RéponsesAujourd'hui en vedette
Sticky position
3 Votes
Help please?
3 Votes
Ejercicio Pytho
0 Votes
Online voting system
2 Votes
What is that z for
0 Votes
Suggestions needed
4 Votes
SQL practice
2 Votes