-->

Wednesday, July 23, 2025

Qbasic program to find area of rectangle and circle using sub and function procedure | SEE computer science datafile program

 

QBasic programs collection-Especially for SEE (Grade-10)

QBasic procedure based programming  questions asked in Triton's model questions

QBasic programs [Triton's model set-I]

declare sub area_rectangle(l,b)

declare function area_circle(r)

Input "enter length and breadth of rectangle"; l, b

Input "enter radius of circle"; r

Call area_rectangle(l, b)

Print "the area of circle is"; area_circle(r)

End

Sub area_rectangle (l, b)

    area = l * b

    Print "the area is"; area

End Sub


Function area_circle (r)

    area_circle = 3.14 * r ^ 2

End Function




Tuesday, July 22, 2025

Qbasic program to read the contents of a datafile | SEE computer science datafile program

 

QBasic programs collection-Especially for SEE (Grade-10)

QBasic procedure based programming  questions asked in Triton's model questions

QBasic programs [Triton's model set]

'q9(b) triton SEE model set set II

Open "record.dat" For Input As #11

Cls

c = 0

While Not EOF(11)

    Input #11, sno, name$, address$, tel, email$

    If LCase$(Right$(email$, 9)) = "yahoo.com" Then

        c = c + 1

        Print name$, address$, email$

    End If

Wend

Print "total records having email is="; c

Close #11

End



Thursday, July 17, 2025

JavaScript Tutorial: Learn Functions and Arrow Functions with Examples

 

JS Function programs collection

JS program to show the concept of arrow function


1. Normal function to return an object
<script>
 function getUser () 
{
return{
//taking the braces in newline terminates the return so the
//followed statement does not work
  name: "Radhe krishna", 
  age: 25 
};
 }
document.write(JSON.stringify(getUser()));
//it converts the object into string with the help of stringify()
</script>


JS program using arrow function to return an object


<script>
 getUser=()=> 
{
return{
//taking the braces in newline terminates the return so the
//followed statement does not work
  name: "Radhe krishna", 
  age: 25 
};
 }
document.write(JSON.stringify(getUser()));
//it converts the object into string with the help of stringify()
</script>

Or


<script>
 getUser=()=> 
(
//() tells JavaScript: “This is  returning an expression.
  {
//taking the braces in newline terminates the return so the
//followed statement does not work
  name: "Radhe krishna", 
  age: 25 
}
 );
document.write(JSON.stringify(getUser()));
//it converts the object into string with the help of stringify()
</script>



Tuesday, July 15, 2025

JavaScript Tutorial: Learn Functions and Arrow Functions with Examples

 

JS Function programs collection

JS program to show the concept of arrow function


1. JS program to print hi using arrow function

<script>
s=()=>//same as function s()
{
  console.log("hi");
}
s();
</script>


2. JS program to print sum of two numbers using arrow function

<script>
sum=()=>//same as function sum()
{
  var a=30,b=20;
  return a+b;
}
console.log(sum());
</script>

Or

traditional way to use function

<script>
function sum()
{
  var a=30,b=20;
  return a+b;
}
console.log(sum());
</script>

3.JS program to print sum of two numbers using arrow function and passing parameters.

<script>
sum=(a,b)=>//means the function sum is accepting two parameters
{
  return a+b;
}
console.log(sum(12,13));
</script>


Or
<script>
sum=(a,b)=> a+b;//means the function sum is accepting two parameters
console.log(sum(12,13));
</script>


Note:We can not use return with a+b e.g. return a+b. Js does not support.
Use under braces. This is called implicit return. It means returning value without using return.

Monday, July 14, 2025

SEE Computer Science: sub procedure program – QBASIC Sub Procedure Program Explained-2081 BS

 

QBASIC programs collection

Sub  procedure program [Triton model question-2081 set V q5]

DECLARE SUB SENDUP (S$)

E$ = "NPABSON"

Call SENDUP(E$)

End

Sub SENDUP (S$)

    For i = 1 To Len(S$) Step 1

        If i Mod 2 <> 0 Then

            EE$ = EE$ + LCase$(Mid$(S$, i, 1))

        Else

            EE$ = EE$ + UCase$(Mid$(S$, i, 1))

        End If

    Next i

    Print EE$

End Sub


SEE Computer Science: sub procedure program – QBASIC Sub Procedure Program Explained-2079 BS

 

QBASIC programs collection- 2079 B.S. GP

Sub and function procedure program [Triton model question]


'rem q9 A 2079 GP

declare sub perimeter(l,b)

declare function area(l,b)

Cls

Input "enter length and breadth"; l, b

Call perimeter(l, b)

Print "the area is"; area(l, b)

End

Sub perimeter (l, b)

    p = 2 * (l + b)

    Print "the perimeter is"; p

End Sub

Function area (l, b)

    area = l * b

End Function


Sunday, July 13, 2025

SEE Computer Science: Triton Model Set II – QBASIC Sub Procedure Program Explained

 

QBASIC programs collection- Triton model sets-II 

Sub procedure program

DECLARE SUB SERIES ( )

Cls

Call series

End

Sub series

    A$ = "NEPAL"

    B = 1

    For I = Len(A$) To 1 Step -2

        If B <> 3 Then

            Print Mid$(A$, B, I)

        Else

            Print Mid$(A$, 1, I)

        End If

        B = B + 1

    Next I

End Sub


Qbasic program to use sub and procedure and to find volume and TSA | SEE computer science procedure program

 

QBasic programs collection-Especially for SEE (Grade-10)

QBasic procedure based programming  questions asked in Triton's model questions

QBasic programs [Triton's model set]

'q9 triton SEE model set set II

declare function volume(l,b,h)
declare sub TSA(l,b,h)
Input "enter l,b,and h"; l, b, h
Call TSA(l, b, h)
Print "the volume is"; volume(l, b, h)
End
Function volume (l, b, h)
    volume = l * b * h

End Function
Sub TSA (l, b, h)

    total_surface_Area = 2 * (l * b + b * h + l * h)
    Print "tsa="; total_surface_Area
End Sub

Qbasic program to read the contents of data file record.dat and to print on screen | SEE computer science datafile program

QBasic programs collection-Especially for SEE (Grade-10)

QBasic Datafile programming of questions asked in Triton's model questions


QBasic program read the contents of datafile and display on screen [Triton's model set]

 

'q9(b) triton SEE model set set II

Open "record.dat" For Input As #11

Cls

c = 0

While Not EOF(11)

    Input #11, sno, name$, address$, tel, email$

    If LCase$(Right$(email$, 9)) = "yahoo.com" Then

        c = c + 1

        Print name$, address$, email$

    End If

Wend

Print "total records having email is="; c

Close #11

End


Friday, July 11, 2025

c program to initialize a string with examples

 

 string programs in C

 // program to initialize a string in C


#include <stdio.h>

#include<string.h>

void main ()

{

char string[] = {'c', 'o', 'm', 'p', 'u', 't', 'e', 'r'};

printf("%s", string);

getch();

}


output:-




Friday, July 4, 2025

c program to reverse a string using function and pointer | pointer examples in c | program with pointer to character function

 

Pointer and string programs in C

 // program to reverse a string using function where we use pointer to character


//WAP to reverse a string using(strrev()) function.Pass string as parameter and return its reverse

#include <stdio.h>

#include<string.h>

#include<conio.h>

char *stringrev(char string[]);

/* function named stringrev() that accepts a string and returns

a char(i.e. pointer to character/string)

int main()

{

    char name[100];//string declaration

    printf("enter string\n");

    scanf("%[^\n]",name); 

    printf("reverse=%s\n",stringrev(name));//prints the name

    getch();

    return 0;

}

char *stringrev(char string[])

{

    strrev(string);

    return string;

}

Thursday, July 3, 2025

c program to use global variables | extern examples in c | C program to use multiples files using extern

 

global variables in C

 /* program to input a number from a different file using external variable and print that

*/

step1:

in devc++,

->click file menu

->click new

->project


-> click console application
->choose c project

->click ok

step 2


under 'main.c' write the code

#include <stdio.h>
extern int a;
void input();
int main() 
{
input();
printf("a=%d",a);
return 0;
}

-------

step 3

->right click the project folder on left side

->click new file as shown above . You can give a name you like
 Here we have taken as untitled3.c

->write the following code
#include<stdio.h>
int a;
void input()
{
 scanf("%d",&a);
}


->save it

->run the program





Monday, June 30, 2025

Qbasic program to read the contents of data file emp.dat and to print on screen | SEE computer science datafile program reading

 


QBasic programs collection-Especially for SEE (Grade-10)


QBasic Datafile programming of questions asked in 2080



QBasic program read the contents of datafile and display on screen SEE 2080 B.S.


Open "emp.dat" For Input As #12

While Not EOF(12)

    Input #12, name$, address$, gender$, salary

    If salary > 60000 Then

        Print name$, address4, gender$, salary

    End If

Wend

Close #12

End




Saturday, June 28, 2025

JavaScript Program to use function to find sum of series– Function concept in JS with Examples

 

JS Function programs collection

JS program to show the concept of function

JS program to find sum of series using function  sum()

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

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

<title>sum of series</title>

</head>

<body>

<h1>the sum is</h1>

<script type="text/javascript">

function sum()

{

var i,sum=0;

for(i=1;i<=100;i++)

{

sum+=i;

}

document.write(sum);

}

</script>

<script type="text/javascript">

sum();

</script>

</body>

</html>

Thursday, June 26, 2025

JavaScript Program to Use querySelector() – DOM Manipulation in JS with Examples

 


JS DOM programs collection



JS program to show the concept of querySelector()

<!-- In JavaScript, 
querySelector() is a method provided by the DOM (Document Object Model) that allows you to select the first HTML element that matches a specified CSS selector. -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>DOM (queryselector)</title>
</head>
<body>
<p id="id1">hello DOM</p>
<script>
var txt;
txt=document.querySelector('#id1');
txt.style.color="green";
</script>

</body>
</html>

Wednesday, June 25, 2025

Table Formatting in C Programming with right and left alignment | Format Specifier Examples with Code

 


C program collection


C program to print the number in the formatted form

//table formatting program in c

#include<stdio.h>

int main()

{

//header part

printf("| %-10s | %-13s | %-11s\n","name","age","address");

printf("| %-12s | %-12d | %-12s\n","Ram",22,"ktm");

printf("| %-12s | %-12d | %-12s\n","sam",24,"pkh");

printf("| %-12s | %-12d | %-12s\n","Raj",27,"bkh");

return 0;

}

output:-

C program to format table


string Formatting in C Programming | Format Specifier Examples with Code

 

C program collection


C program to print the number in the formatted form

//string formatting in c program

#include<stdio.h>

int main()

{

char name[]="Radhekrishna";

char name1[]="krishna";

printf("name=%s\n",name);

printf("[%20s]-right alignment\n",name);

printf("[%-20s]-left alignment\n",name);

printf("[%.3s]-only three characters.\n",name1);

printf("[%s]-all characters\n",name1);

return 0;


}


C program to format the string


Number Formatting in C Programming | Format Specifier Examples with Code

 C program collection


C program to print the number in the formatted form


//number formatting in program

#include<stdio.h>

int main()

{

int num=3453;

float pi=3.141592;

printf("default=%d\n",num);

printf("10 character width=[%10d]\n",num);

printf("left aligned:[%-8d]\n",num);

printf("default:%f\n",pi);

printf("10 width with 4 decimal:[%12.4f]\n",pi);

printf("exponential form:%.3e\n",pi);

return 0;

}


c program to format the number in output


Friday, June 20, 2025

JavaScript Program to Use getElementsByTagName() to change the color of paragraphs | DOM Manipulation in JS with Examples


JS DOM programs collection


JavaScript Program  to change the color of different paragraphs  using getElementsByTagName(DOM)


<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

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

<title>color of different paragraphs</title>

</head>

<body>

<p>text1</p>

<p>text2</p>

<p>text3</p>

<p>text4</p>

<button onclick="highlights()">click to highlight the paragraphs</button>

<script>

function highlights()

{

let i;

item=document.getElementsByTagName('p');

for(i=0;i<=3;i++)

{

item[i].style.backgroundColor="orange";

}

}

</script>


</body>

</html>

JavaScript Program to Use getElementById() to change the color of paragraphs with different ids | DOM Manipulation in JS with Examples


JS DOM programs collection




JavaScript Program to Use getElementById() to change the color of different paragraphs having different ids  using getElementById (DOM)



<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>looping through multiple ids</title>
</head>
<body>
<p id="i1">text1</p>
<p id="i2">text2</p>
<p id="i3">text3</p>
<p id="i4">text4</p>
<button onclick="highlights()">click to highlight the paragraphs</button>
<script>
function highlights()
{
let i;
for(i=1;i<=4;i++)
{
item=document.getElementById('i'+i);
item.style.backgroundColor="orange";
}
}
</script>
</body>
</html>

Thursday, June 19, 2025

JavaScript Program to Use getElementById() to display text itself after typing | DOM Manipulation in JS with Examples

 

JS DOM programs collection




JavaScript Program to Use getElementById() to display text itself entered by user  using getElementById (DOM)






<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

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

<title>auto appearing text</title>

</head>

<body>

<form>

enter your text:<br>

<input type="text" id="data" oninput="textappear()">


</form>

<p id="text">

</p>

<script type="text/javascript">

function textappear()

{

var t;

t=document.getElementById('data').value;

document.getElementById('text').innerText=t;

}

</script>


</body>

</html>

Sunday, June 15, 2025

Qbasic program to know the output using dry run table | SEE computer science programming guide in Qbasic -to know the greater number

 

QBasic programs collection-Especially for SEE (Grade-10)



QBasic program to know the output of program using dry run table- to find the greater number, using sub procedure


declare sub pabson(A,b)

Cls

x = 15

y = 10

Call pabson(x, y)

Call pabson(3, 6)

End

Sub pabson (a, b)

    If a < b Then

        Print a

    Else

        Print b

    End If

End Sub








Qbasic program to get output using dry run table | SEE computer science programming guide in Qbasic -to find sum of numbers using function procedure

QBasic programs collection-Especially for SEE (Grade-10)

QBasic program to know the output of program using dry run table- to find the sum of numbers given as 1,2,3,4,5, using function procedure

declare function num(A)

Cls

For x = 1 To 5

    Read n

    s = s + num(n)

Next x

Print s

Data 1,2,3,4,5

End

Function num (a)

    num = a ^ 2

End Function

output:-


program to find the output of given program


Qbasic program to get output using dry run table and to write a program using | SEE computer science programming guide in Qbasic

 


QBasic programs collection-Especially for SEE (Grade-10)



QBasic program to convert a string into uppercase using function procedure

'wap to input a string in lowercase and convert that into uppercase

'use function procedure

declare function uppercase$(a$)

Cls

Input "ente a string"; a$

Print "string in upper case is="; uppercase(a$)

End

Function uppercase$ (a$)

    uppercase$ = UCase$(a$)


End Function


Thursday, June 12, 2025

JavaScript Program to Use getElementById() – DOM based program in JS to convert string into uppercase

 


JS DOM programs collection


JS program to convert entered string into uppercase by user using getElementById()

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

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

<title>js program to convert into uppercase</title>

</head>

<body>

<form>

enter your text:<input type="text" id="mytext" placeholder="enter a text">

</form>

<button onclick="convertintouppercase();">change into uppercase</button>

<p id="result"></p>

<script>

function convertintouppercase()

{

var txt;

txt=document.getElementById('mytext').value;

document.getElementById('result').innerText=txt.toUpperCase();

}

</script>

</body>

</html>


Output:-

JS code to convert string into uppercase



JavaScript Program to Use getElementById() – DOM based program to find sum of two numbers

 

JS DOM programs collection

JS program to find sum of two numbers entered by user using getElementById() (DOM)


<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

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

<title>js program to find sum of two numbers using text boxes</title>

</head>

<body>

<form>

enter first number:<input type="text" id="n1" placeholder="enter first number"><br>

enter second number:<input type="text" id="n2" placeholder="enter second number"><br>

</form>

<button onclick="sumnumbers();">click to find the sum</button>

<p>sum is:<span id="resultsum"></span></p>

<p>difference is:<span id="resultdiff"></span></p>

<script>

function sumnumbers()

{

var number1,number2,sum;

number1=parseFloat(document.getElementById('n1').value);

number2=parseFloat(document.getElementById('n2').value);

sum=number1+number2;

document.getElementById('resultsum').innerText=sum;

document.getElementById('resultdiff').innerText=number1-number2;

}

</script>

</body>

</html>


Output:

JS program to find sum of two numbers entered by user


Wednesday, June 11, 2025

Qbasic program to find area and perimeter using function and sub procedure | SEE computer science programming guide -2078 questions

 


QBasic programs collection-Especially for SEE (Grade-10)





Qbasic program to find area and perimeter using function and sub procedure ;Question asked in 2078 B.S.

'q9 a to find area and perimeter using sub and function procedure

Declare sub perimeter(l,b)

declare function area(l,b)

Cls

Input "enter l and b"; l, b

Call perimeter(l, b)

Print "the area is"; area(l, b)

End

Sub perimeter (l, b)

    p = 2 * (l + b)

    Print "the perimeter="; p

End Sub

Function area (l, b)

    area = l * b

End Function

output:

program to find area and perimeter



Tuesday, June 10, 2025

Qbasic program to get output using dry run table | SEE computer science programming guide in Qbasic -to find sum of numbers divisible by 4

 

QBasic programs collection-Especially for SEE (Grade-10)



QBasic program to know the output of program using dry run table- to find the sum of numbers between 1 and 20 and which are divisible by 4, using sub procedure



declare sub sum(A)

A = 2

Call sum(A)

End

Sub sum (A)

    While A <= 20

        If A Mod 4 = 0 Then

            s = s + A

        End If

        A = A + 1

    Wend

    Print s

End Sub

Dry run table

A

While A<=20

        If A Mod 4 = 0

S=s+A

A=A+1

2

yes

no

 

A=3

3

yes

no

 

A=4

4

yes

yes

S=s+A=0+4=4

A=5

5

yes

no

 

A=6

6

yes

no

 

A=7

7

yes

no

 

A=8

8

y

yes

S=4+8=12

A=9

9

yes

n

 

=10

10

yes

n

 

=11

11

yes

N

 

=12

12

yes

y

=12+12=24

A=13

13

yes

n

 

=14

14

yes

n

 

=15

15

yes

n

 

=16

16

yes

y

=24+16=40

=17

17

yes

n

 

=18

18

yes

n

 

=19

19

yes

n

 

=20

20

yes

y

=40+20=60

21

21

no

 

 

 


output:60

Qbasic program to get output using dry run table | SEE computer science programming guide in Qbasic -to find sum of 1 to 9 with 2 step increment

 QBasic programs collection-Especially for SEE (Grade-10)


QBasic program to know the output of program using dry run table- to find the sum of numbers between 1 and 9 using function procedure

declare function find()

Print find

End

Function find ()

    For n = 1 To 9 Step 2

        Let s = s + n

    Next n

    find = s

End Function

Dry run table

N=1 to 9 step 2

S=s+n

find

 

N=1;true

S=0+1=1

 

 

N=3;true

S=1+3=4

 

 

N=5;true

S=4+5=9

 

 

N=7;true

S=9+7=16

 

 

N=9;true

S=s+N=16+9=25

 

 

N=11;false

 

Find=s=25

 


output

25