Posts

Ads

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>RSA Encryption</title> </head> <body> <center>   <h1>RSA Encryption</h1>   <form id="rsaForm">     <label for="p">Enter First Prime Number:</label>     <input type="number" id="p" value="53"><br>     <label for="q">Enter Second Prime Number:</label>     <input type="number" id="q" value="59"><br>     <label for="msg">Enter Message (Cipher Text):</label>     <input type="number" id="msg" value="89"><br>     <button type="button" onclick="RSA()">Apply RSA</button>   </form>   <hr>   <div i

fun.

import java.io.*; import java.net.*; public class EchoServer {     private ServerSocket server;     public EchoServer(int portnum) {         try {             server = new ServerSocket(portnum);         } catch (Exception err) {             System.out.println(err);         }     }     public void serve() {         try {             while (true) {                 Socket client = server.accept();                 BufferedReader r = new BufferedReader(new InputStreamReader(client.getInputStream()));                 PrintWriter w = new PrintWriter(client.getOutputStream(), true);                 w.println("Welcome to the Java EchoServer. Type 'bye' to close");                 String line;                 do {                     line = r.readLine();                     if (line != null) {                         w.println("Got: " + line);                         System.out.println(line);                     }                 } while (!line.trim().equals("bye

2333333

%{ #include<stdio.h> %} %% int|char|float|return { printf("\n%s=> Keywords",yytext);} #.* { printf("\n%s=>Preprocessor Directive",yytext);} printf|scanf|main { printf("\n%s=>functions",yytext);} ["][a-z]+["] { printf("\n%s=>Strings",yytext);} [[a-z]|[A-Z]][[a-z]|[A-Z]|[0-9]]+ { printf("\n%s=>Identifiers",yytext);} [0-9] { printf("\n%s=>Numbers",yytext);} "+"|"-"|"*"|"/"|"%" { printf("\n%s=>Operators",yytext);} ","|";"|"&"|"("|")"| [" ] |"{"|"}" { printf("\n%s=>Special Characters",yytext);} %% int main() { FILE *fp; fp=fopen("input.txt","r"); yyin=fp; yylex(); return 0; } int yywrap() { return 1; }

github

https://github.com/phoenix30coder/LAB

2

<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">   <xs:element name="student">     <xs:complexType>       <xs:sequence>         <xs:element name="std1">           <xs:complexType>             <xs:sequence>               <xs:element type="xs:string" name="name"/>               <xs:element type="xs:byte" name="regno"/>               <xs:element type="xs:string" name="address"/>               <xs:element type="xs:short" name="phoneno"/>             </xs:sequence>           </xs:complexType>         </xs:element>         <xs:element name="std2">           <xs:complexType>             <xs:sequence>               <xs:element type="xs:string" name="name"/>  

1

<?xml version="1.0" encoding="UTF-8" ?> <student xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"         xsi:noNamespaceSchemaLocation="sample_schema.xsd">      <std1>         <name>anitha</name>   <regno>001</regno> <address>chennai</address> <phoneno>12345</phoneno>      </std1>      <std2>         <name>kalai</name>   <regno>002</regno> <address>trichy</address> <phoneno>34521</phoneno>      </std2>      <std3>         <name>gopal</name>   <regno>003</regno> <address>nagercoil</address> <phoneno>54321</phoneno>      </std3>      <std4>         <name>shiva</name>   <regno>004</regno> <address>madurai</address> <phoneno>45342</phoneno>      </std4> </student>

linear search

import random from timeit import default_timer as timer import matplotlib.pyplot as plt def binary_search(n, a, k, low, high):     """Implements binary search algorithm to find an element in a list."""     mid = int((low + high) / 2)     if low > high:         return -1     if k == a[mid]:         return mid     elif k < a[mid]:         return binary_search(n, a, k, low, mid - 1)     else:         return binary_search(n, a, k, mid + 1, high) x = [] y = [] for i in range(5):     # Generate a list of random integers     n = int(input("\nenter the value of n:"))     x.append(n)     arr = [x for x in range(n)]     k = random.randint(0, n)     start = timer()     ind = binary_search(n, arr, k, 0, n - 1)     end = timer()     y.append(end - start)     print("array elements are in the range of 0-",n)     print("k value=", k)     print("time taken=", end - start)     print("element is at the index:", ind) # P