Skip to main content

Posts

1D Array in C , Hackerrank C answer

  #include   < stdio.h > #include   < string.h > #include   < math.h > #include   < stdlib.h > int  main() {      int  n,i,sum= 0 ;     scanf( "%d" ,&n);      int  arr[n];      for (i= 0 ;i<n;i++)     {         scanf( "%d" ,&arr[i]);     }      //sum array elements      for (i= 0 ;i<n;i++)     {         sum=sum+arr[i];     }     printf( "%d" ,sum);      /* Enter your code here. Read input from STDIN. Print output to STDOUT */           return   0 ; }

Spoken Tutorial Linux Test answer

 1. we can use command "Alt + T" in the terminal in ubuntu environment? a) True  b) False 2.  Justify whether the commands given below are true or false .  a . $ > chmod -R 744 programming --- > This command is used to assign read , write , execute permission to owner and readonly for all others on programming folder .  b . $ > chown - R www - data : www - data --- > This command is used to change the ownership of all the folders and subfolders including files , under current directory to www - data user . a) True         b) False 3. We can use the commands $ > Is -1 | wc -1 > filecount.txt to check the count of number of files in a directory ? Select one a) True  b) False 4.  The following commands will help us identify the number of lines of code written in programcode.c file . $ > programcode.c | wc - a) True   b) False 5.  Identify whether the output of the following commands is tru...

How to make calculator using HTML in notepad

CODE:-  <html> <head> <script> //function that display value function dis(val) { document.getElementById("result").value+=val } //function that evaluates the digit and return result function solve() { let x = document.getElementById("result").value let y = eval(x) document.getElementById("result").value = y } //function that clear the display function clr() { document.getElementById("result").value = "" } </script> <!-- for styling --> <style> .title{ margin-bottom: 10px; text-align:center; width: 210px; color:green; border: solid black 2px; } input[type="button"] { background-color:green; color: black; border: solid black 2px; width:100% } input[type="text"] { background-color:white; border: solid black 2px; width:100% } </style> </head> ...

Matrix Rain using notepad

  CODE:- @echo off color 02 :start echo %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% goto start SAVE AS- matix rain.bat OUTPUT:-

Arduino based voice control car code

 #include <SoftwareSerial.h> SoftwareSerial BT(0, 1); //TX, RX respetively String readvoice; void setup() {  BT.begin(9600);  Serial.begin(9600);   pinMode(4, OUTPUT);   pinMode(3, OUTPUT);   pinMode(5, OUTPUT);   pinMode(6, OUTPUT); } //-----------------------------------------------------------------------//  void loop() {   while (BT.available()){  //Check if there is an available byte to read   delay(10); //Delay added to make thing stable   char c = BT.read(); //Conduct a serial read   readvoice += c; //build the string- "forward", "reverse", "left" and "right"   }    if (readvoice.length() > 0) {     Serial.println(readvoice);   if(readvoice == "*forward#")   {     digitalWrite(3, HIGH);     digitalWrite (4, HIGH);     digitalWrite(5,LOW);     digitalWrite(6,LOW);     delay(100);   }   else if(readvoice == "*back#"...

Snake game using python

  CODE: import math import random import pygame import random import tkinter as tk from tkinter import messagebox width = 500 height = 500 cols = 25 rows = 20 class cube():     rows = 20     w = 500     def __init__(self, start, dirnx=1, dirny=0, color=(255,0,0)):         self.pos = start         self.dirnx = dirnx         self.dirny = dirny # "L", "R", "U", "D"         self.color = color     def move(self, dirnx, dirny):         self.dirnx = dirnx         self.dirny = dirny         self.pos  = (self.pos[0] + self.dirnx, self.pos[1] + self.dirny)                  def draw(self, surface, eyes=False):         dis = self.w // self.rows         i = self.pos[0]         j = self.pos[1]     ...