Computer 8 Dec
Computer 8 Dec
Python Programs
OUTPUT
Enter a distance in miles:4.5
OUTPUT
One million seconds are equal to 11.574074074074074
Program to accept three integers and print the largest of the
three.
OUTPUT
OUTPUT
Enter a number:9
9 is odd.
Program that takes a number and print table of that's
number.
OUTPUT
Enter an integer number:7
7 * 1 = 7
7 * 2 = 14
7 * 3 = 21
7 * 4 = 28
7 * 5 = 35
7 * 6 = 42
7 * 7 = 49
7 * 8 = 56
7 * 9 = 63
7 * 10 = 70
1.sum = 0
2.for a in range(1,11):
3.sum+=a
4.print("Sum of netural numbers upto 10
in",a,"is",sum)
OUTPUT
Sum of netural numbers upto 10 in 1 is 1
Sum of netural numbers upto 10 in 2 is 3
Sum of netural numbers upto 10 in 3 is 6
Sum of netural numbers upto 10 in 4 is 10
Sum of netural numbers upto 10 in 5 is 15
Sum of netural numbers upto 10 in 6 is 21
Sum of netural numbers upto 10 in 7 is 28
Sum of netural numbers upto 10 in 8 is 36
Sum of netural numbers upto 10 in 9 is 45
Sum of netural numbers upto 10 in 10 is 55
OUTPUT
Enter the number of fibonacco series:8
1 2 3 5 8 13 21 3
Write a program to know the number is prime or not.
1.num = 17
2.if num>1:
3. for i in range(2,(num//2)+1):
4. if(num%i)==0:
5. print(num,"is not a prime number.")
6. break
7. else:
8. print(num,"is a prime number.")
9. else:
10. print(num,"is not a prime number.")
OUTPUT
17 is a prime number.