Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

379
Vistas
Find sum of all odd number in given range

You are given a number stored in a variable with the name N

You have to print N lines such that on each line you find the sum of all odd numbers in the range of[1,i], where i represents all the numbers in the range of[1,N]

For example, consider the value stored inN = 3

Then, first we find the sum of all even numbers, in the range of [1,1], which comes out to be 1, as there is one odd number (1) in the range

Then, we find the sum of all even numbers, in the range of [1,2], which comes out to be 1, as there is only 1 odd number (1). Hence, the sum becomes 1

Finally, we find the sum of all even numbers in the range of [1,3], which comes out to be 4, as there are two odd numbers (1,3) in the given range. Hence, the sum becomes 4

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda