The website is displaying a strange mix of text and HTML when viewed on a PC

While browsing the internet for C programs, I stumbled upon this particular program that caught my eye:

<span style='color:#004a43'>#</span><span style='color:#004a43'>include</span><span style='color:#800000'>&lt;</span><span style='color:#40015a'>stdio.h</span><span style='color:#800000'>&gt;</span>

<span style='color:#200080;font-weight:bold'>void</span> areaperi <span style='color:#308080'>(</span> <span style='color:#200080;font-weight:bold'>int</span> r<span style='color:#308080'>,</span> <span style='color:#200080;font-weight:bold'>float</span> <span style='color:#308080'>*</span>a<span style='color:#308080'>,</span> <span style='color:#200080;font-weight:bold'>float</span> <span style='color:#308080'>*</span>p <span style='color:#308080'>)</span>
<span style='color:#406080'>{</span>
<span style='color:#308080'>*</span>a <span style='color:#308080'>=</span> <span style='color:#008000'>3.14</span> <span style='color:#308080'>*</span> r <span style='color:#308080'>*</span> r <span style='color:#406080'>;</span>
<span style='color:#308080'>*</span>p <span style='color:#308080'>=</span> <span style='color:#008c00'>2</span> <span style='color:#308080'>*</span> <span style='color:#008000'>3.14</span> <span style='color:#308080'>*</span> r <span style='color:#406080'>;</span>
<span style='color:#406080'>}</span>

<span style='color:#200080;font-weight:bold'>void</span> <span style='color:#400000'>main</span><span style='color:#308080'>(</span> <span style='color:#308080'>)</span>
<span style='color:#406080'>{</span>
<span style='color:#200080;font-weight:bold'>int</span> radius <span style='color:#406080'>;</span>
<span style='color:#200080;font-weight:bold'>float</span> area<span style='color:#308080'>,</span> perimeter <span style='color:#406080'>;</span>

<span style='color:#003060'>printf</span> <span style='color:#308080'>(</span> <span style='color:#800000'>"</span><span style='color:#0f69ff'>n</span><span style='color:#1060b6'>Enter radius of a circle </span><span style='color:#800000'>"</span> <span style='color:#308080'>)</span> <span style='color:#406080'>;</span>
<span style='color:#003060'>scanf</span> <span style='color:#308080'>(</span> <span style='color:#800000'>"</span><span style='color:#0f69ff'>%d</span><span style='color:#800000'>"</span><span style='color:#308080'>,</span> <span style='color:#308080'>&amp;</span>radius <span style='color:#308080'>)</span> <span style='color:#406080'>;</span>

areaperi <span style='color:#308080'>(</span> radius<span style='color:#308080'>,</span> <span style='color:#308080'>&amp;</span>area<span style='color:#308080'>,</span> <span style='color:#308080'>&amp;</span>perimeter <span style='color:#308080'>)</span> <span style='color:#406080'>;</span>

<span style='color:#003060'>printf</span> <span style='color:#308080'>(</span> <span style='color:#800000'>"</span><span style='color:#1060b6'>Area = </span><span style='color:#0f69ff'>%f</span><span style='color:#800000'>"</span><span style='color:#308080'>,</span> area <span style='color:#308080'>)</span> <span style='color:#406080'>;</span>
<span style='color:#003060'>printf</span> <span style='color:#308080'>(</span> <span style='color:#800000'>"</span><span style='color:#0f69ff'>n</span><span style='color:#1060b6'>Perimeter = </span><span style='color:#0f69ff'>%f</span><span style='color:#800000'>"</span><span style='color:#308080'>,</span> perimeter <span style='color:#308080'>)</span> <span style='color:#406080'>;</span>
<span style='color:#406080'>}</span>

When I accessed it from my phone, everything displayed correctly. However, on my computer, only some parts showed as text while others appeared as HTML.

I'm curious to understand why this discrepancy is occurring. Any insights would be appreciated. Thanks in advance.

Answer №1

The website "c4learn.com" appears to be malfunctioning, and I'm unable to access it properly on my phone as well.

It seems like they intended to showcase a syntax-highlighted version of the C program but mistakenly displayed the HTML source code for the highlighted listing instead.

In order to view the C program, you'll need to execute the HTML source code. You can achieve this by saving it as an HTML file and opening it in your browser. Alternatively, you can utilize online HTML/CSS/JS editors like the one offered on StackOverflow (simply click the "Run code snippet" button below):

<div style="white-space: pre">
<span style='color:#004a43'>#</span><span style='color:#004a43'>include</span><span style='color:#800000'>&lt;</span><span style='color:#40015a'>stdio.h</span><span style='color:#800000'>&gt;</span>

<span style='color:#200080;font-weight:bold'>void</span> areaperi <span style='color:#308080'>(</span> <span style='color:#200080;font-weight:bold'>int</span> r<span style='color:#308080'>,</span> <span style='color:#200080;font-weight:bold'>float</span> <span style='color:#308080'>*</span>a<span style='color:#308080'>,</span> <span style='color:#200080;font-weight:bold'>float</span> <span style='color:#308080'>*</span>p <span style='color:#308080'>)</span>
<span style='color:#406080'>{</span>
<span style='color:#308080'>*</span>a <span style='color:#308080'>=</span> <span style='color:#008000'>3.14</span> <span style='color:#308080'>*</span> r <span style='color:#308080'>*</span> r <span style='color:#406080'>;</span>
<span style='color:#308080'>*</span>p <span style='color:#308080'>=</span> <span style='color:#008c00'>2</span> <span style='color:#308080'>*</span> <span style='color:#008000'>3.14</span> <span style='color:#308080'>*</span> r <span style='color:#406080'>;</span>
<span style='color:#406080'>}</span>

<span style='color:#200080;font-weight:bold'>void</span> <span style='color:#400000'>main</span><span style='color:#308080'>(</span> <span style='color:#308080'>)</span>
<span style='color:#406080'>{</span>
<span style='color:#200080;font-weight:bold'>int</span> radius <span style='color:#406080'>;</span>
<span style='color:#200080;font-weight:bold'>float</span> area<span style='color:#308080'>,</span> perimeter <span style='color:#406080'>;</span>

<span style='color:#003060'>printf</span> <span style='color:#308080'>(</span> <span style='color:#800000'>"</span><span style='color:#0f69ff'>n</span><span style='color:#1060b6'>Enter radius of a circle </span><span style='color:#800000'>"</span> <span style='color:#308080'>)</span> <span style='color:#406080'>;</span>
<span style='color:#003060'>scanf</span> <span style='color:#308080'>(</span> <span style='color:#800000'>"</span><span style='color:#0f69ff'>%d</span><span style='color:#800000'>"</span><span style='color:#308080'>,</span> <span style='color:#308080'>&amp;</span>radius <span style='color:#308080'>)</span> <span style='color:#406080'>;</span>

areaperi <span style='color:#308080'>(</span> radius<span style='color:#308080'>,</span> <span style='color:#308080'>&amp;</span>area<span style='color:#308080'>,</span> <span style='color:#308080'>&amp;</span>perimeter <span style='color:#308080'>)</span> <span style='color:#406080'>;</span>

<span style='color:#003060'>printf</span> <span style='color:#308080'>(</span> <span style='color:#800000'>"</span><span style='color:#1060b6'>Area = </span><span style='color:#0f69ff'>%f</span><span style='color:#800000'>"</span><span style='color:#308080'>,</span> area <span style='color:#308080'>)</span> <span style='color:#406080'>;</span>
<span style='color:#003060'>printf</span> <span style='color:#308080'>(</span> <span style='color:#800000'>"</span><span style='color:#0f69ff'>n</span><span style='color:#1060b6'>Perimeter = </span><span style='color:#0f69ff'>%f</span><span style='color:#800000'>"</span><span style='color:#308080'>,</span> perimeter <span style='color:#308080'>)</span> <span style='color:#406080'>;</span>
<span style='color:#406080'>}</span>
</div>

(Please note that I enclosed the code within a

<div style="white-space: pre">
tag to ensure proper display of spacing.)

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What methods can be used to differentiate between value equality and reference equality when watching something?

In the world of AngularJS, the $watch function comes with an interesting twist - it has an optional third parameter. By default, this parameter is set to false, which means the watch will only trigger if the watched reference changes. But if you set it to ...

Preserving variable scope in JavaScript even after defining a function

I am facing an issue with my JavaScript code that involves invoking a function within a function: var obj = { // returns the function with prevent default prepended. run: function(functor, context){ return function(e){ e.preventDefault(); ...

Updating the Wordpress menu: Get rid of the list items and instead add the class ".current-menu-item" directly to the anchor tag

Is there a way to customize the output of wp_nav_menu(); to display a navigation menu like this: <nav> <a>Menu Item</a> <a class="current-menu-item">Menu Item</a> <a>Menu Item</a> <a>Menu Ite ...

Add HTML syntax highlighting to a text area for coding purposes

I am facing a seemingly straightforward issue, but I worry that it may be too complex for me to handle on my own. My goal is to incorporate a textarea into a webpage where users can input HTML code, click a button, and have the interpreted HTML displayed i ...

Leveraging Angular for REST API Calls with Ajax

app.controller('AjaxController', function ($scope,$http){ $http.get('mc/rest/candidate/pddninc/list',{ params: { callback:'JSON_CALLBACK' } }). success(function (data, status, headers, config){ if(ang ...

The navigation bar does not display the CSS when in the active state

I created a navigation bar in ReactJS and I need the tabs to stay highlighted when clicked, but the styles are not applying correctly. I have double-checked that the stylesheet is linked properly based on the Reactjs file structure. For reference, I used ...

Is it possible to return a promise after utilizing .then() in AngularJS?

As someone who is still getting the hang of Angular and promises, I want to make sure I'm on the right track. Right now, my data layer service uses Restangular to fetch data and returns a promise. Here's how it looks... dataStore.getUsers = fun ...

Unable to run for loop in vue.js

Hello, I'm a newcomer to using Vue.js and am encountering an issue with executing a simple for loop in my code. Any assistance or guidance would be greatly appreciated. Here is the snippet of my code: var Vue = require('vue'); Vue.use(requi ...

Retrieve the most recent information from the database based on a specific column

Is there a way to retrieve only the most recent row from each category in the database? Example Database: Table name: Colors id category timestamp 1 yellow 14/2/2014 2 blue 13/2/2014 3 red 14/2/2014 4 yellow 13/2/2014 5 blue 11/2/2014 ...

What is the best way to accomplish this using typescript/adonis?

While exploring some code examples on Bitbucket, I came across a sample that demonstrated how to paginate query results using JavaScript. However, as I attempted to apply it in my project, I encountered difficulties in declaring the types required for the ...

Enhanced SSL connectivity features in Meteor version 1.8.1

My development server is running on localhost (Windows 10 Pro x64 build 1903) and will eventually be moved to the production environment (Galaxy). To enable authentication through Facebook or Google, HTTPS is required. I configured Nourharidy Meteor SSL on ...

Placing an icon to the left of the primaryText within the <ListItem> component of Material UI

Seeking to enhance a <ListItem> from React Material UI that currently displays a checkbox on the left side. My goal is to insert an image or icon between the checkbox and the title, positioned to the left of the title. Upon reviewing the documentatio ...

Merge together JQuery variables

I want to assign a unique number to each JavaScript variable and jQuery element in my code. Take a look at the snippet below: $("#insert1").click(function(){ var collegeId1=$("#collegeId1").val(); $.post('insert.php', {collegeId: colle ...

NextJs Link component does not refresh scripts

While using the <Link> tag in NextJs for page navigation, I encountered an issue where my scripts do not rerun after switching pages. The scripts only run on the initial page load or when I manually reload the page. This behavior is different when us ...

Using Django Sessions for User Authentication in React Applications

Not a coding query, but rather a general one: When using default authentication in Django (session authentication), what does the frontend (in my case it's React) require? For instance, upon logging in on the browser via the front end login button, th ...

Discovering the ways to retrieve Axios response within a SweetAlert2 confirmation dialog

I'm struggling to grasp promises completely even after reviewing https://gist.github.com/domenic/3889970. I am trying to retrieve the response from axios within a sweetalert confirmation dialog result. Here is my current code: axios .post("/post ...

Toggle css comment line using gulp

Is it possible to temporarily deactivate a particular CSS comment on a specific line using Gulp and then reactivate it after completing a build task? As an illustration, I am interested in deactivating the @import 'compass/reset'; statement loca ...

Utilizing JavaScript to pass parameters to an IFRAME within Dynamics CRM

While trying to access http://localhost:80/testsite in an IFRAME, everything seems to work perfectly. However, once I attempt to pass field values as parameters, nothing happens. Oddly enough, accessing the page directly from a browser with parameters work ...

Ways to identify the specific occurrence when the nth image is displayed within a div containing an image slider

I am working on an image carousel with unique elements for each slide: <div class="outer_wrapper_hide" id="outer_wrapperID"> <div class="inner_wrapper" id="inner_wrapperID"> <img id="slideimage1" class="slideimage" height="500" ...

Difficulty encountered with cURL while attempting to submit information to a Gravity Form on an external website

I am managing two DISTINCT websites: Website A: An interactive Wordpress site featuring a Gravity Form. Website B: A separate non-Wordpress site that hosts a basic form - the information collected from this form needs to be transferred to Website A' ...