0% found this document useful (0 votes)
1K views

Paa S

The documents describe Google App Engine programs to: 1) Generate even numbers from a user-input number. 2) Multiply two matrices. 3) Display the nth largest number from a list. Each program is deployed to Google Cloud using App Engine and includes an index.html page and App.yaml configuration file.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views

Paa S

The documents describe Google App Engine programs to: 1) Generate even numbers from a user-input number. 2) Multiply two matrices. 3) Display the nth largest number from a list. Each program is deployed to Google Cloud using App Engine and includes an index.html page and App.yaml configuration file.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

1) Write a Google app engine program to generate n even numbers and deploy it to

google cloud.

INDEX.HTML

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<meta name="description" content="Hello App Engine">

<title>Hello App Engine</title>

</head>

<body>

<script type= "text/javascript">

<!--

/*globals nbsp */

const aNumber = Number(window.prompt("Type a number", ""));

var a = 1;

for(a = 1; a <= aNumber ; a++)

if(a%2===0)
{

document.write(a &nbsp &nbsp);

//-->

</script>

App.yaml
runtime: python27

api_version: 1

threadsafe: true

handlers:

- url: /

static_files: www/index.html

upload: www/index.html

- url: /(.*)

static_files: www/\1

upload: www/(.*)
2. Google app engine program multiply two matrices.

INDEX.HTML

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<meta name="description" content="Hello App Engine">

<title>JavaScript function to get nth largest element from an unsorted array.</title>

</head>

<body>

<script type= "text/javascript">

<!--

function multiply(a, b) {

var aNumRows = a.length, aNumCols = a[0].length,

bNumRows = b.length, bNumCols = b[0].length,

m = new Array(aNumRows); // initialize array of rows

for (var r = 0; r < aNumRows; ++r) {

m[r] = new Array(bNumCols); // initialize the current row

for (var c = 0; c < bNumCols; ++c) {

m[r][c] = 0; // initialize the current cell

for (var i = 0; i < aNumCols; ++i) {


m[r][c] += a[r][i] * b[i][c];

return m;

function display(m) {

for (var r = 0; r < m.length; ++r) {

document.write('&nbsp;&nbsp;'+m[r].join(' ')+'<br />');

var a = [[8, 3], [2, 4], [3, 6]],

b = [[1, 2, 3], [4, 6, 8]];

document.write('matrix a:<br />');

display(a);

document.write('matrix b:<br />');

display(b);

document.write('a * b =<br />');

display(multiply(a, b));

//-->

</script>

App.yaml
runtime: python27

api_version: 1

threadsafe: true

handlers:

- url: /

static_files: www/index.html

upload: www/index.html

- url: /(.*)

static_files: www/\1

upload: www/(.*)

3.Write a Google app engine program to display nth largest no from the given list of
numbers and deploy it into google cloud.
INDEX.HTML
<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<meta name="description" content="Hello App Engine">

<title>JavaScript function to get nth largest element from an unsorted array.</title>

</head>
<body>

<script type= "text/javascript">

<!--

function nthlargest(arra,highest){

var x = 0,

y = 0,

z = 0,

temp = 0,

tnum = arra.length,

flag = false,

result = false;

while(x < tnum){

y = x + 1;

if(y < tnum){

for(z = y; z < tnum; z++){

if(arra[x] < arra[z]){

temp = arra[z];

arra[z] = arra[x];

arra[x] = temp;

flag = true;

}else{

continue;
}

if(flag){

flag = false;

}else{

x++;

if(x === highest){

result = true;

if(result){

break;

return (arra[(highest - 1)]);

document.write(nthlargest([ 43, 56, 23, 89, 88, 90, 99, 652], 4));

//-->

</script>
App.yaml
runtime: python27

api_version: 1

threadsafe: true

handlers:

- url: /

static_files: www/index.html

upload: www/index.html

- url: /(.*)

static_files: www/\1

upload: www/(.*)

You might also like