Showing posts with label Home. Show all posts
Showing posts with label Home. Show all posts

Saturday, October 16, 2021

WAP to print the count of the vowels present in a given sentence.

WAP to print the count of the vowels present in a given sentence.

DECLARE SUB VOWEL (V$)

CLS 

INPUT "ENTER A SENTENCE"; N$

CALL VOWEL (N$)

END

SUB VOWEL (V$)

V$ = "a, e, i, o, u"

IF N$= a AND  e AND I AND o AND u THEN

PRINT "NO. OF VOWEL IS"; N$

NEXT I 

END SUB 

Click here for more...

WAP to check if an entered number is Armstrong or not.

WAP to check if an entered number is Armstrong or not.

DECLARE SUB ARM$ (A)
CLS
INPUT ''ENTER A NUMBER";N
END
SUB ARM$ (A)
B=A 
WHILE A< > 0 THEN
R = N MOD 10
S = S+R^3
N = N/10
WEND
IF A=B THEN PRINT ''ARMSTRONG''
ELSE
 PRINT ''NOT ARMSTRONG''
END SUB

WAP to find the sum of factors of a given number. (USING SUB PROCEDURE)

WAP to find the sum of factors of a given number. (USING SUB PROCEDURE)

DECLARE SUB SUM FACTORS (A)

CLS

INPUT "ENTER A NUMBER"; A

CALL SUM FACTORS (A)

END 

SUB SUM FACTOR (A)

F=1

FOR I =1 TO N

F=F*I

S=S+2

NEXT I 

PRINT "THE SUM OF FACTORS OF NUMBER IS"; S

END SUB

Click here for more...

WAP to find factorial of a given number.(USING SUB PROCEDURE)

WAP to find factorial of a given number. (USING SUB PROCEDURE)

DECLARE SUB FACTORIAL (A)

CLS

INPUT ''ENTER A NUMBER'';X 

CALL FACTORIAL (X)

END

SUB FACTORIAL (A)

FOR I = 1 TO A

F = A*I

NEXT I

PRINT "THE FACTORIAL OF A NUMBER IS"; F

END SUB

Click here for more...

WAP to check entered number is palindrome or not using sub procedure.

 WAP to check entered number is palindrome or not using subprocedure.

DECLARE SUB-PALI$ (P)

CLS

INPUT ''ENTER A NUMBER"; N

CALL PALINDROME (N)

END

SUB PALINDROME (P) 

A=N

WHILE A<>0

R=N MOD 10

S=S*10 +R

N=N/10

WEND

IF N=A THEN PRINT ''PALINDROME"

ELSE 

PRINT "NOT PALINDROME"

END SUB

Click here for more...

WRITE A QBASIC PROGRAM TO FIND AREA OF A SQUARE USING SUB PROCEDURE

WRITE A QBASIC PROGRAM TO FIND THE AREA OF A SQUARE USING SUB PROCEDURE

DECLARE SUB-AREA (L)
CLS 
INPUT "ENTER ANY NUMBER"; A
CALL AREA (A)
END 
SUBAREA (L)
B=L^2
PRINT "THE AREA OF SQUARE IS"; B
END SUB

Friday, October 15, 2021

Modular Programming (What is modular programming language? Explain)

Modular Programming/What is modular programming? Explain.

Modular programming

Modular programming is defined as the programming technique that is used to divide a program into various sections known as modules to make a task easier. The advantages of dividing a program into modules i.e multiple sets of tasks can be done in a single program.

For example: In a single program we use incorporate addition, subtraction, multiplication, and division all at the same time using modules. 

Module

A module can be defined as the section of a program that is designed to perform a specific task. 

For Example: In a program that calculates area the module that calculates the area of a rectangle area of a square can be created.

Main Module 

The main module can be defined as the main component of a program that handles the job of calling other sub-modules and running a program. This is similar to a CEO of an office that provides and designates operations to other staff in the office.


Sub Module or Producers 

They are the small modules that are incorporated in the main module to add various features to the same program. 

For Example: In a program that says calculator sub-modules such as addition, subtraction, division, and multiplication can be added to add multiple numbers of services, etc.

The modules or procedures can be mainly divided into two types in Q-BASIC.

They are:

A. Sub-procedure

B. Function procedure

A. Sub-procedure

This is a module or sub-procedure which can be called by the main module to perform a particular task. The parameters of this procedure can be defined in the procedure declaration part and the same parameters can be passed on to the submodule by the main module using calling features of the subprocedure.

The basic structure of the subprocedure is given below:

MAIN MODULE

Declare sub-sub-procedure- name (parameters)- Declaration 

.....

CALL Sub procedure name (Arguments)...... call

SUBMODULE

Sub sub-procedure-name (parameters)

code or statements

}

END SUB

view for more results...



Sharkey

Simple way to make website using HTML only.

 A simple way to make a website using HTML only. <!DOCTYPE html> <head>         <title>Document</title> </head...