0

I am trying to load html from assets folder which contained C Programming code but I got error like

Error:(7, 19) Error: The reference to entity "ltstdio.h" must end with the ';' delimiter.

in android studio

P_Armstrong_number.java

    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.webkit.WebView;

    public class P_Armstrong_number extends AppCompatActivity {

         WebView wv;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_p__armstrong_number);

            wv=(WebView)findViewById(R.id.wv_amstrong_number);
            wv.loadUrl("file:///android_asset/arm_series.html");


        }
    }

activity_p_armstrong_number.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.MyfirstApp.P_Armstrong_number"
    android:id="@+id/wv_amstrong_number">

    <WebView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/webView"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true" />
</RelativeLayout>

arm_series.html

<html>
      <head>
      </head>
      <body>
       <h4>Armstrong series:<br/></h4>
    <p>
    #include&ltstdio.h&gt <br/>
    #include&ltconio.h&gt <br/>
    #include<math.h> <br/>
    main()<br/>
    {<br/>
        int n,m;<br/>
        printf("Enter from where to start:\n");<br/>
        scanf("%d",&n);<br/>
        printf("Enter where to end:\n");<br/>
        scanf("%d",&m);<br/>
        int num=0;<br/>

        int i=n;<br/>
        while(i<=m)<br/>
        {<br/>
            num=num+i;<br/>
            int sum=0;<br/>
            while(num!=0)<br/>
        {<br/>
                int rm=num%10;<br/>
                sum=sum+(rm*rm*rm);<br/>
                num=num/10;<br/>
            }<br/>
            if(sum==i)<br/>
            printf("%d ",sum);<br/>
            i++;<br/>
        }<br/>
        getch();<br/>
    }<br/>
    </p>
    <p>
    <h4>Output:</h4>Enter from where to start:<br/>
    1<br/>Enter where to end:<br/>500<br/>1 153 370 371 407
    </p>
        </body>
    </html>

I am stuck on this please help me from this error

Vasily Kabunov
  • 6,511
  • 13
  • 49
  • 53
Student
  • 25
  • 2
  • 11

1 Answers1

0

The problem in the following strings:

#include&ltstdio.h&gt <br/>
#include&ltconio.h&gt <br/>

Try to add ; symbols like this:

#include&lt;stdio.h&gt; <br/>
#include&lt;conio.h&gt; <br/>

The ampersand & is a special symbol. &lt; uses to show < symbol.

Vasily Kabunov
  • 6,511
  • 13
  • 49
  • 53