1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Makovka662 [10]
2 years ago
15

Write a program to find the sum of first 10 even numbers in qbasic​

Computers and Technology
1 answer:
kipiarov [429]2 years ago
5 0

Answer:

CLS. FOR I = 1 TO 10. INPUT "ENTER THE NUMBERS"; N(I) IF N(I) MOD 2 = 0 THEN S = S + N(I) ...

You might be interested in
Write a program that reads numbers from a file (or allow user to input data) and creates an ordered binary tree. The program sho
IgorLugansk [536]

Answer:

See explaination

Explanation:

include<bits/stdc++.h>

using namespace std;

typedef struct Node

{

int data;

struct Node *left,*right;

}Node;

bool search(Node *root,int data)

{

if(root==NULL)

return false;

if(root->data==data)

return true;

queue<Node*> q;

q.push(root);

while(!q.empty())

{

Node *temp=q.front();

q.pop();

if(temp->data==data)

return true;

if(temp->left)

q.push(temp->left);

if(temp->right)

q.push(temp->right);

}

return false;

}

Node *insert(Node *root,int data)

{

if(root==NULL)

{

Node *temp=new Node();

temp->data=data;

temp->left=NULL;

temp->right=NULL;

return temp;

}

if(data < root->data)

root->left=insert(root->left,data);

if(data>root->data)

root->right=insert(root->right,data);

return root;

}

Node *get_smallest_element_right_subtree(Node *root)

{

while(root && root->left!=NULL)

root=root->left;

return root;

}

Node *delete_node(Node *root,int data)

{

if(root==NULL)

return root;

if(data < root->data)

root->left=delete_node(root->left,data);

else if(data > root->data)

root->right=delete_node(root->right,data);

else

{

if(root->left==NULL) //If right only presents means - delete the curr node and return right node

{

Node *temp=root->right;

free(root);

return temp;

}

else if(root->right==NULL) //If left only presents means - delete the curr node and return let node

{

Node *temp=root->left;

free(root);

return temp;

}

else

{

Node *temp=get_smallest_element_right_subtree(root->right);

root->data=temp->data;

root->right=delete_node(root->right,temp->data);

}

return root;

}

}

void inorder(Node *root)

{

if(root!=NULL)

{

inorder(root->left);

cout<<root->data<<" ";

inorder(root->right);

}

}

void postorder(Node *root)

{

if(root!=NULL)

{

inorder(root->left);

inorder(root->right);

cout<<root->data<<" ";

}

}

void preorder(Node *root)

{

if(root!=NULL)

{

cout<<root->data<<" ";

inorder(root->left);

inorder(root->right);

}

}

int main()

{

fstream f;

string filename;

cout<<"\n\n1 - Input through File ";

cout<<"\n\n2 - Input through your Hand";

int h;

cout<<"\n\n\nEnter Your Choice : ";

cin>>h;

Node *root=NULL; // Tree Declaration

if(h==1)

{

cout<<"\n\nEnter the Input File Name : ";

cin>>filename;

f.open(filename.c_str());

if(!f)

cout<<"\n\nError in Opening a file !";

else

{

cout<<"\n\nFile is Being Read ........";

string num;

int value;

int node=0;

while(f>> num)

{

value=stoi(num);

root=insert(root,value);

node++;

}

cout<<"\n\nTree has been successfully created with : "<<node<<" Nodes"<<endl;

}

}

if(h==2)

{

int y;

cout<<"\n\nEnter the Total No of Input :";

cin>>y;

int i=1,g;

while(i!=y+1)

{

cout<<"\n\nEnter Input "<<i<<" : ";

cin>>g;

root=insert(root,g);

i++;

}

cout<<"\n\nTree has been successfully created with : "<<y<<" Nodes"<<endl;

}

if(h>=3)

{

cout<<"\n\nInvalid Choice !!! ";

return 0;

}

int n=0;

while(n!=6)

{

cout<<"\n\n\n1 - Insert Element";

cout<<"\n\n2 - Remove Element";

cout<<"\n\n3 - Inorder (LNR) Display ";

cout<<"\n\n4 - Pre (NLR) Order Display";

cout<<"\n\n5 - Post (LRN) Order Display";

cout<<"\n\n6 - Quit";

cout<<"\n\nEnter Your Choice : ";

cin>>n;

switch(n)

{

case 1:

{

int k;

cout<<"\n\nEnter Element to insert : ";cin>>k;

root=insert(root,k);

cout<<"\n\nElement Sucessfully Inserted !!!!!";

break;

}

case 2:

{

int k;

cout<<"\n\nEnter Element to Remove : ";

cin>>k;

if(search(root,k))

{

root=delete_node(root,k);

cout<<"\n\nValue Successfully Deleted !!!";

}

else

cout<<"\n\n!!!!!!!!!!!!!!!!!!!! No Such Element !!!!!!!!!!!!!!!!!!!!!!";

break;

}

case 3:

{

cout<<"\n\nThe Elements (LNR) are : ";

inorder(root);

break;

}

case 4:

{

cout<<"\n\nThe Elements (NLR) are : ";

preorder(root);

break;

}

case 5:

{

cout<<"\n\nThe Elements (LRN) are : ";

postorder(root);

break;

}

case 6:

{

break;

}

}

}

cout<<"\n\nBye!!!! See You !!!"<<endl;

7 0
3 years ago
You are trying to appreciate how important the principle of locality is in justifying the use of a cache memory, so you experime
murzikaleks [220]

Answer:

Explanation:

Attached is the solution

3 0
3 years ago
What type of attacks take advantage of vulnerabilities in poorly coded web application software to introduce malicious program c
Yakvenalex [24]

Answer:

SQL Injection

Explanation:

Coding a web application that uses a database is requiring close attention, where the developer closes any loophole any attacker may later want to exploit when the application is deployed. SQL Injection is a type of attack where the attacker places malicious code in the query statements through the form. This is possible if the input is not properly sanitized and cleaned.

5 0
2 years ago
Explain how loops can be utilized in list processing. Please provide Python examples in your response.
Dominik [7]

Answer:

data = [0,1,2,3,4]

for i in range(4):

   print(data[i])

   i+=1

Explanation:

Loops can be utilized in a listing process by looping back to a list with a variable while the loop increases that variable to give a different response from the list.

8 0
1 year ago
Sub to the channel plz plz
Hunter-Best [27]

Answer:

um

Explanation:

6 0
2 years ago
Read 2 more answers
Other questions:
  • According to the appendix what was the purpose of newspeak
    12·1 answer
  • Explain word processing ​
    11·2 answers
  • Technician A says that it's a good idea to perform a test drive before attempting repairs. Technician B says that it's a good id
    9·2 answers
  • Who distributes IP Address?
    10·1 answer
  • A group of computers that are interconnected in order to share information or documents is called what?
    13·1 answer
  • What color mode would you use when designing for web &amp; devices?
    9·1 answer
  • 1. Insert a Header that has the following in excel​
    14·1 answer
  • How are comments in a Java program treated by the compiler?
    14·2 answers
  • Does anyone know this? Can someone please help me? I’ll give brainliest!!
    7·1 answer
  • Select one Layer 2 or wireless WAN technology presented in Lesson 3. Elaborate on its characteristics, pros and cons, and common
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!