Computer Science, asked by geetharudregowda53, 9 months ago

18. Write a program to input 10 integers and find the sum of two digit as well as three digit numbers
separately.
19. Write a program to input 10 integers and display the largest as well as the smallest integer.
20. Write a program to input 10 integers and check whether all the entered numbers are even numbers
by the
or not.​

Answers

Answered by gaganadithyareddy9
1

Answer:

These codes work only in python...

18th Question:

nums = [ ]

sum_2 = 0

sum_3 = 0

for i in range(10):

   x = int(input("Enter a number: "))

   nums.append(str(x))

for i in nums:

   if len(i) == 2:

       sum_2+=int(i)

   elif len(i) == 3:

       sum_3+=int(i)

print('Sum of all 2 digit numbers = ', sum_2)

print('Sum of all 3 digit numbers = ', sum_3)

19th question:

lst = [ ]

for i in range(10):

   x = int(input("Enter a number: "))

   lst.append(x)

print('Largest number = ', max(lst))

print('Smallest number = ', min(lst))

20th Question:

def odd_even(num):

   if num%2 == 0:

       print('It is even number')

   else:

       print('It is odd number')

       

for i in range(10):

   x = int(input("Enter number: "))

   if odd_even(x) and odd_even(x+1):

       print("All are even numbers")

# HOPE THIS HELPS YOU!!

# Please mark my answer as brainliest

Answered by nmahi4577
0

Answer:

import Java. util. * ;

class Q18

{

public static void main ()

{

int

scanner SC= new scanner ( system. in) ;

system. out. println( " enter 10 integers") ;

for ( I=1 ;1<10;I++)

{

n=SC.next int () ;

if (n>10 && n<99)

52+n;

if (n>=100 && n<= 999)

53+=n;

}system.out . println(" sum of 2 digit no"=52);

system. out. println("sum of 3 digit no"=53) ;

}}

Similar questions