Social Icons

Pages

C Program to print the series


12345
2345
345
45
5

#include <stdio.h>
#include<conio.h>
void main()
{
    int i, j;
  clrscr();
    for(i=1;i<=5;i++)
    {
        for(j=i;j<=5;j++)
        {
            printf("%d",j);
        }
        printf("\n");
    }

    getch();
}

C Program TO Print the Folliwing Series Using Loop

12345
1234
123
12
1

#include <stdio.h>

void main()
{
    int i, j;
    for(i=5;i>=1;i--)
    {
        for(j=1;j<=i;j++)
        {
            printf("%d",j);
        }
        printf("\n");
    }

    getch();
}

C programe to find simple and compound interest

#include<stdio.h>
#include<conio.h>
#include<math.h>

void main()
{
    float p,q,r,SI,CI;
    int n;
    clrscr();
   
    printf("Enter the value of Principal p = ");
    scanf("%f \n",&p);
    printf("Enter the value of Rate r = ");
    scanf("%f \n",&r);
    printf("Enter the value of Period n = ");
    scanf("%d \n",&n);
   
    SI = (p*r*n)/100;

    printf("Simple Interest SI=%f \n",SI);
   
    q = 1+(r/100);
    CI=p*pow(q,n);
   
    printf("Compound Interest CI=%f \n",CI);
   
    getch();
}

Hill Cipher Algorithm Program in C

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,ans[25][1],sum=0,mtrx[25][25],end;
char txt[25];
clrscr();
printf("\nEnter the string : ");
scanf("%s",txt);
//clrscr();
for(i=0;i<25;i++)
{
if(txt[i]>=97 && txt[i]<122) {}
else
{
end=i;
break;
}
}
for(i=0;i<end;i++)
{
//printf("initial : %d ",txt[i]);
txt[i]=txt[i]-'a';
//printf("final : %d ",txt[i]);
//printf("\n\n");
}
clrscr();
printf("\nEnter matrix...\n");
for(i=0;i<end;i++)
{
for(j=0;j<end;j++)
{
scanf("%d",&mtrx[i][j]);
}
}
for(i=0;i<end;i++)
{
sum=0;
for(j=0;j<end;j++)
{
sum+=mtrx[i][j]*(int)txt[j];
}
ans[i][0]=sum;
}
for(i=0;i<end;i++)
{
printf(" %c",((ans[i][0])%26)+97);
}
getch();
}

Convert Celsius to Fahrenheit








Insert a number into one of the input fields below:

degrees Celsius

equals

degrees Fahrenheit

Note that the Math.round() method is used, so that the result will be returned as an integer.




Click To Know Today's Day





Click the button to display todays day of the week.








How to Display Current Date & Time

<!DOCTYPE html>
<html>
<head>
<script>
function displayDate()
{
document.getElementById("demo").innerHTML=Date();
}
</script>
</head>
<body>

<h1>
Today's date is</h1>
<p id="demo">
</p>

<button type="button" onclick="displayDate()">Display Date</button>

</body>
</html>

How to display Current Date & Time








Today's date is






How to remove the default text in textbox when clicked on it

<html><head><title>(Type a title for your page here)</title>

  <script type="text/javascript">
  function make_blank()
  {
  document.form1.type.value ="";
  }
  </script>

  </head>
  <body >

  <form name=form1 method=post action='test.php'>
  <input type=text name=type value='Enter your user id' onClick="make_blank();"></form>

  </body>
  </html>

C program Code to shutdown,restart,logoff,hibernate the computer

  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include<conio.h>
  4. void main()
  5. {
  6. int ch;
  7. clrscr();
  8. printf("\n\n~~~~~~~~~~~~~~~~~SHUTDOWN MENU~~~~~~~~~~~~~~~~~~~\n");
  9. printf("1.Shutdown\n2.Restart\n3.Logoff\n4.Hibernate\n5.exit");
  10. printf("\nEnter choice : ");
  11. scanf("%d",&ch);
  12. switch(ch)
  13. {
  14. case 1:system("shutdown -s");
  15. break;
  16. case 2:system("shutdown -r");
  17. break;
  18. case 3:system("shutdown -l");
  19. break;
  20. case 4:system("shutdown -h");
  21. break;
  22. case 5:exit(1);
  23. break;
  24. default:printf("Invalid choice");
  25. }
  26. getch();
  27. }

Code to shutdown the computer using C Program

#include <stdio.h>
#include <stdlib.h>
  
main()
{
   char ch;
  
   printf("Do you want to shutdown your computer now (y/n)\n");
   scanf("%c",&ch);
  
   if (ch == 'y' || ch == 'Y')
      system("C:\\WINDOWS\\System32\\shutdown -s");
  
   return 0;
}
JAVA EXample to GeT the Greetings

<!DOCTYPE html>
<html>
<body>

<p>Click the button to get a greeting.</p>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction()
{
var x="";
var time=new Date().getHours();
if (time<12)
  {
  x="Good day";
  }
else if (time<16)
 {
 x="Good afternoon";
 }
else if (time<19)
 {
 x="Good evening";
 }
else
 {
 x="Good night"
 }
document.getElementById("demo").innerHTML=x;
}
</script>

</body>
</html>






Click the button to get a greeting.








Example of HTML+JAVA to see how much time had been spent by you on my blog










Click on the "Start count!" button above to start the timer. The input field will count forever, starting at 0. Click on the "Stop count!" button to stop the counting. Click on the "Start count!" button to start the timer again.


HTML+JAVA to see how much time had been spent by us there


<html>
<head>
<script>
var c=0;
var t;
var timer_is_on=0;

function timedCount()
{
document.getElementById('txt').value=c;
c=c+1;
t=setTimeout(function(){timedCount()},1000);
}

function doTimer()
{
if (!timer_is_on)
  {
  timer_is_on=1;
  timedCount();
  }
}

function stopCount()
{
clearTimeout(t);
timer_is_on=0;
}
</script>
</head>

<body>
<form>
<input type="button" value="Start count!" onclick="doTimer()" />
<input type="text" id="txt" />
<input type="button" value="Stop count!" onclick="stopCount()" />
</form>
<p>
Click on the "Start count!" button above to start the timer. The input field will count forever, starting at 0. Click on the "Stop count!" button to stop the counting. Click on the "Start count!" button to start the timer again.
</p>
</body>
</html>

Error message











Click the button to wait 2 seconds, then alert "Hello".

After clicking away the alert box, an new alert box will appear in 2 seconds. This goes on forever...






Loop function in java


<html>
<body>

<p>Click the button to do a loop with a break.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>

<script>
function myFunction()
{
var x="",i=0;
for (i=0;i<10;i++)
  {
  if (i==3)
    {
    break;
    }
  x=x + "The number is " + i + "<br>";
  }
document.getElementById("demo").innerHTML=x;
}
</script>

</body>
</html>

To get Cookies value

function getCookie(c_name)
{
var c_value = document.cookie;
var c_start = c_value.indexOf(" " + c_name + "=");
if (c_start == -1)
{
c_start = c_value.indexOf(c_name + "=");
}
if (c_start == -1)
{
c_value = null;
}
else
{
c_start = c_value.indexOf("=", c_start) + 1;
var c_end = c_value.indexOf(";", c_start);
if (c_end == -1)
{
c_end = c_value.length;
}
c_value = unescape(c_value.substring(c_start,c_end));
}
return c_value;
}

Try it and have fun


<html>
<body>

<p>Click the button to wait 3 seconds, then alert "Hello".</p>
<p>After clicking away the alert box, an new alert box will appear in 3 seconds. This goes on forever...</p>
<button onclick="myFunction()">Try it</button>

<script>
function myFunction()
{
setInterval(function(){alert("Hello")},3000);
}
</script>

</body>
</html>

Must try this html


<html>
<body>

<p>Click the button to demonstrate the prompt box.</p>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction()
{
var x;

var person=prompt("Please enter your name","Harry Potter");

if (person!=null)
  {
  x="Hello " + person + "! How are you today?";
  document.getElementById("demo").innerHTML=x;
  }
}
</script>

</body>
</html>

A pop up alert box in java


<html>
<head>
<script>
function myFunction()
{
alert("Hello! I am an alert box!");
}
</script>
</head>
<body>

<input type="button" onclick="myFunction()" value="Show alert box" />

</body>
</html>

java operator for increament


<html>
<body>

<p>Given that y=5, calculate x=y++, and display the result.</p>
<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction()
{
var y=5;
var x=y++;
var demoP=document.getElementById("demo")
demoP.innerHTML="x=" + x + ", y=" + y;
}
</script>

<p><strong>Note:</strong> Both variables, x and y, are affected.</p>
</body>
</html>

css Positioning


<html>
<head>
<style>
h2.pos_left
{
position:relative;
left:-20px;
}

h2.pos_right
{
position:relative;
left:20px;
}
</style>
</head>

<body>
<h2>This is a heading with no position</h2>
<h2 class="pos_left">This heading is moved left according to its normal position</h2>
<h2 class="pos_right">This heading is moved right according to its normal position</h2>
<p>Relative positioning moves an element RELATIVE to its original position.</p>
<p>The style "left:-20px" subtracts 20 pixels from the element's original left position.</p>
<p>The style "left:20px" adds 20 pixels to the element's original left position.</p>
</body>

</html>

css attribute selector


<html>
<head>
<style>
[lang|=en]
{
color:blue;
}
</style>
</head>

<body>
<h2>Will apply to:</h2>
<p lang="en">Hello!</p>
<p lang="en-us">Hi!</p>
<p lang="en-gb">Ello!</p>
<hr>
<h2>Will not apply to:</h2>
<p lang="us">Hi!</p>
<p lang="no">Hei!</p>
</body>
</html>