Posts

Write a program to calculate implement Monoalphabetic cipher encryption - decryption.

Image
  Code: import java.util.Scanner; public class MonoalphabeticCipher { public static void main(String[] args) { char []real={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; char []mono={'q','w','e','r','t','y','u','i','o','p','a','s','d','f','g','h','j','k','l','z','x','c','v','b','n','m'}; Scanner sc = new Scanner(System. in ); String str; int len; System. out .print("1. Encryption 2. Decryption: "); int choice = sc.nextInt(); switch (choice) {

Write a program to implement Caesar Cipher encryption - decryption.

Image
  Code: import java.util.Scanner; public class CaesarCipher { public static void main(String []args) { Scanner sc=new Scanner(System. in ); System. out .print("1. Encryption 2. Decryption: "); int choice = sc.nextInt(); switch (choice) { case 1: System. out .print("Enter plain text:"); String text = sc.next(); System. out .print("Enter Key:"); int key = sc.nextInt(); System. out .println("Encrypted text is: " + encrypted (text,key)); break; case 2: System. out .print("Enter Encrypted text:"); text = sc.next(); System. out .print("Enter Key:"); key = sc.nextInt(); System. out .println("Decrypted text is: "+ decrypted (text,key)); break; default:

Program to implement Recursive Descent Parsing in C.

Image
  Code: #include<stdio.h> static char c[10]; char input; void E(),EPRIME(); int main() {     printf("Enter a String: ");     scanf("%s",c);       E();     if(c[input]=='$')         printf("Valid String\n");     else         printf("Invalid String\n");     return 0; }   void E() {     if (c[input] == 'i')         input++;     EPRIME(); }   void EPRIME()     {     if (c[input]== '+') {         input++;         if(c[input]=='i')             input++;         EPRIME();     }     else         return; } Output:

Write a JavaScript program to check whether given number is Palindrome or not

Image
  Code: <!DOCTYPE   html > <html   lang = "en" > <head>      <meta   charset = "UTF-8" >      <meta   name = "viewport"   content = "width=device-width, initial-scale=1.0" >      <title> Practical-14 </title> </head> <body>      <script>                   //Pallindrome          var   num  =  prompt ( "Enter the number" );          var   str  =  0 ,              rem ;          var   temp  =  num ;          while  ( num  >  0 ) {              rem  =  num  %  10 ;              num  =  parseInt ( num  /  10 );              str  =  str  *  10  +  rem ;         }          if  ( temp  ==  str ) {              alert ( "Your Number is Pallindrome" );         }  else  {              alert ( "Your Number is not Pallindrome" );         }      </script> </body> </html> Output:

Write a JavaScript program to calculate sum of 1 to n numbers

Image
  Code: <!DOCTYPE   html > <html   lang = "en" > <head>      <meta   charset = "UTF-8" >      <meta   name = "viewport"   content = "width=device-width, initial-scale=1.0" >      <title> Practical-14 </title> </head> <body>      <script>          var   num  =  prompt ( "Enter the number " );          var   sum  =  0 ;          for  ( let   i  =  0 ;  i  <=  num ;  i ++) {              sum  =  sum  +  i ;         }          alert ( `Sum of the 1 to  ${ num }  numbers is :`  +  sum );               </script> </body> </html> Output:

Write a JavaScript program to calculate factorial of n numbers

Image
  Code: <!DOCTYPE   html > <html   lang = "en" > <head>      <meta   charset = "UTF-8" >      <meta   name = "viewport"   content = "width=device-width, initial-scale=1.0" >      <title> Practical-13 </title> </head> <body>      <script>          //Write a program to calculate factorial of n (Note: Use prompt box to get input from the user.)          var   num  =  prompt ( "Enter the Number" );          var   fact  =  1 ;          for  ( let   i  =  1 ;  i  <=  num ;  i ++) {              fact  =  fact  *  i ;         }          alert ( "Factorial of the number is : "  +  fact );      </script> </body> </html> Output:

Write JavaScript program To find highest from given three values

Image
  Code: <!DOCTYPE   html > <html   lang = "en" > <head>      <meta   charset = "UTF-8" >      <meta   name = "viewport"   content = "width=device-width, initial-scale=1.0" >      <title> Practical-12 </title> </head> <body>      <Script>          //Write JavaScript to perform the following operations: a)to find highest from given three values          var   num1  =  prompt ( "Enter first Number" );          var   num2  =  prompt ( "Enter Second Number" );          var   num3  =  prompt ( "Enter third number" );          var   largest ;          if  ( num1  >  num2  &&  num1  >  num3 ) {              largest  =  num1 ;         }  else   if  ( num2  >  num1  &&  num2  >  num3 ) {              largest  =  num2 ;         }  else   if  ( num3  >  num1  &&  num3  >  num2 ) {              largest  =  num3 ;         }