# data[].attributes.headline
Spot the error and correct the code below!

# data[].attributes.subject
Spot the error and correct the code below!

# data[].attributes.headline
Write a program which accepts a variable n and displays all the numbers from 0 to n.

# data[].attributes.subject
Write a program which accepts a variable n and displays all the numbers from 0 to n.

# data[].attributes.body
Eg:-

n=7

Output=0 1 2 3 4 5 6 7

n=20
Output=0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

# data[].attributes.headline
Write a program to calculate the sum of first 10 natural numbers.

# data[].attributes.subject
Write a program to calculate the sum of first 10 natural numbers.

# data[].attributes.headline
Write a program to print out all Armstrong numbers between 1 and 450. If sum of cubes of each digit of the number is equal to the number itself, then the number is called an Armstrong number.

# data[].attributes.subject
Write a program to print out all Armstrong numbers between 1 and 450. If sum of cubes of each digit of the number is equal to the number itself, then the number is called an Armstrong number.

# data[].attributes.body
Eg:-
371=(3*3*3)+(7*7*7)+(1*1*1)

# data[].attributes.body
Write a for loop program to display the following pattern.
*
**
***
****
*****

# data[].attributes.body
It’s should be I - - and not I ++

# data[].attributes.body
It should be I— insted of I++

# data[].attributes.body
Scanner sc= newScanner(System.in);

System.out.println(“Enter a number”);

int m = sc.nextInt();

for(int i=0; i<=m; i++)

{

System.out.print(i+” “);

}

# data[].attributes.body
int x=Sc.nextInt()
for(var i=x;i,=x;i++)
{
System.out.print(x + " ");
}

# data[].attributes.body
for(int i=1;i<=5;i++)
{
for(int j=1;j<=i;j++)
{
System.out.println(“*”);
}
}

# data[].attributes.body
For(int i = 0;i<=n;i++){
System.Out.Println(i)
}

# data[].attributes.body
Int n = sc.nextInt()
Int X = 0
For(n, x<=n, x++)
System.out.print(x + “, “)

# data[].attributes.body
scanner sc =newScanner(system.in)
System.out.println(“Enter a number”
int n=sc.nextInt();
for(int x=0; x<=n; x++)
{
system.out.println(x+” “);
}

# data[].attributes.body
int x=Sc.nextInt()
for(int i=x;i,=x;i++)
{
System.out.print(x);
}

# data[].attributes.body
for(int x=1;x<=5;x++)
{
for(int i=1;i<=x;i++)
{
System.out.println(“*”);
}
}

# data[].attributes.body
Scanner sc= newScanner(System.in);
System.out.println("ENter a Number");
int n=sc.nextInt();
for( int i =0; i<=m; i++)
{
System.out.print(i+" ")
}//end

# data[].attributes.body
int low = 1, high = 450;

    for(int number = low + 1; number < high; ++number) {
      int digits = 0;
      int result = 0;
      int originalNumber = number;


      while (originalNumber != 0) {
        originalNumber /= 10;
        ++digits;
      }

      originalNumber = number;

      while (originalNumber != 0) {
        int remainder = originalNumber % 10;
        result += Math.pow(remainder, digits);
        originalNumber /= 10;
      }

      if (result == number) {
        System.out.print(number + " ");

# data[].attributes.body
For (int i=0;i<=n;i++) {
System.Out. Println(i)}

# data[].attributes.headline
public class Armstrong{    public static void main(String[] args)      {        int n, count = 0, a, b, c, sum = 0;        System.out.print("Armstrong numbers from 1 to 1000:");        for(int i = 1; i <= 450; i++)        {            n = i;            while(n > 0)            {                b = n % 10;                sum = sum + (b * b * b);                n = n / 10;            }            if(sum == i)            {                System.out.print(i+" ");            }            sum = 0;        }    }}

# data[].attributes.subject
public class Armstrong{    public static void main(String[] args)      {        int n, count = 0, a, b, c, sum = 0;        System.out.print("Armstrong numbers from 1 to 1000:");        for(int i = 1; i <= 450; i++)        {            n = i;            while(n > 0)            {                b = n % 10;                sum = sum + (b * b * b);                n = n / 10;            }            if(sum == i)            {                System.out.print(i+" ");            }            sum = 0;        }    }}

# data[].attributes.body
Scanner sc= new Scanner(System.in);

System.out.println(“Enter a number: “);

int n=sc.nextInt();

for(int i =0; i<=n;i++)

{

System.out.print(i+“ “);

}

# data[].attributes.body
Scanner sc=newScanner(System.in);
System.out.println(“Enter any number”);
int n=sc.nextInt();

int i;

for(i=0;i<=n;i++)

{

system.out.print(i+” ”);
}

# data[].attributes.body
1. public class SumOfNaturalNumber1

2. {

3. public static void main(String[] args)

4. {

5. int i, num = 10, sum = 0;

6. //executes until the condition returns true

7. for(i = 1; i <= num; ++i)

8. {

9. //adding the value of i into sum variable

10. sum = sum + i;

11. }

12. //prints the sum

13. System.out.println("Sum of First 10 Natural Numbers is = " + sum);

14. }

15. }

# data[].attributes.body
for(var x =1; x<=5;x++;)
{
for(var n=1;n<=x;n++;)
{system.out.println(“*”);
}
}

# data[].attributes.body
Scanner sc= newScanner(System.in);

System.outPrintln (“Enter the number”);
int i;

For ( i=0, i<=n, i++)

{

system.outPrintln(n + “ “);

}

# data[].attributes.body
Scanner sc=newScanner (System.in);
System.out.println("Enter a number");
int x=sc.nextInt();
for(int i=0;i<=x;x++)
{
System.out.println(x+" ");
}