Posts

Showing posts from December, 2020

How to find HCF/GCD with C#?

Image
using System; public class Test { private static int HCF(int x, int y) { if (0 == x) return y; if (0 == y) return x; if (x == y) return x; if (x < y) return HCF(x, y-x); return HCF(x-y, y); } private static int GCD(int x, int y) { if (0 == y) return x; return GCD(y, x % y); } public static void Main(string[]args) { int x = 14, y = 18; Console.WriteLine("HCF of {0} & {1} is {2}", x, y, HCF(x, y)); Console.WriteLine("GCD of {0} & {1} is {2}", x, y, GCD(x, y)); } }

How to find area & volume of different shapes with C#?

Image
using System; interface Shape{ double Area{get;} string Desc{get;} }; interface TwoDimensionalShape : Shape {} interface ThreeDimensionalShape : Shape { double Volume{get;} } class Circle: TwoDimensionalShape{ private double Radius; public Circle(double r){Radius = r;} public double Area{ get{ return ((Radius * Radius) * Math.PI); }} public string Desc{get{return "A circle";}} } class Square: TwoDimensionalShape{ private double Side; public Square(double s){Side = s;} public double Area{ get{ return (Side * Side); }} public string Desc{get{return "A square";}} } class Sphere: ThreeDimensionalShape{ private double Radius; public Sphere(double r){Radius = r;} public double Area{ get{ return (4 * Math.Pow(Radius,2) * Math.PI); }} public double Volume{ get{ return (4/3.0 * Math.Pow(Radius,3) * Math.PI); }} public string Desc{get{return "A sphere";}} } class Cube: ThreeDimensionalShape{ private double Side; public Cub

✔ Cpp Program ⚡ How to convert Fahrenheit to Celsius with C++?🔥

Image
#include<iostream> #include<iomanip> using namespace std; void calcCelsius(float fahrenheit, float *celsius){ (*celsius) = ((5.0f/9.0f) * (fahrenheit - 32.0f)); } int main(){ float fahrenheit, celsius; cout << "Enter fahrenheit: "; cin >> fahrenheit; calcCelsius(fahrenheit, &celsius); cout << "Celsius: " << setprecision(0) << fixed << celsius << endl; }

✔ C Sharp Code ⚡ Find avg per student from .csv file 🔥

Image
using System; using System.IO; class Ex{ public static void Main(string[]args){ float avg; string line; string[]parts; using(StreamReader inf = new StreamReader("ex2.csv")){ using(StreamWriter outf = new StreamWriter("ex2-out.csv")){ while(null != (line = inf.ReadLine())){ parts = line.Split(','); avg = ((int.Parse(parts[1])+int.Parse(parts[2])+int.Parse(parts[3]))/3.0f); outf.WriteLine("{0},{1:0.00}",parts[0],avg); } } } } } Download

✔ C Sharp File IO⚡ Find min, max & avg of numbers from .txt file 🔥

Image
using System; using System.IO; class Ex{ public static void Main(string[]args){ int min = 0, max = 0, sum = 0, num, cnt = 0; string line; using(StreamReader file = new StreamReader("ex1.txt")){ while(null != (line = file.ReadLine())){ cnt ++; num = int.Parse(line); sum += num; if(min > num || 1 == cnt) min = num; if(max < num || 1 == cnt) max = num; } } float avg = (sum/(1.0f*cnt)); Console.WriteLine("min: {0}, max: {1}, avg: {2}, sum: {3}", min, max, avg, sum); } } Download

✔ JavaFx Programming ⚡ Convert feet to meters 🔥 Tecq Mate Tutorials ✌

Image
import javafx.application.Application; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.RadioButton; import javafx.scene.control.ToggleGroup; import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; import javafx.scene.text.Text; import javafx.scene.paint.Color; import javafx.scene.control.Toggle; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.stage.Stage; public class ConverterApp extends Application { private void resetUI(TextField tf1, TextField tf2, Text t){ tf1.setText(""); tf2.setText(""); t.setText(""); tf1.setEditable(true); tf2.setEditable(false); } @Override public void start(Stage stage) { TextField tfFeet = new TextField(); TextField tfMeter = new

✔ Cpp/C++ Program ⚡ Find min, max, avg from vector of int 🔥 Tecq Mate Tutorials

Image
#include<iostream> #include<vector> using namespace std; void maxMinAve(vector<int>); int main(){ vector<int> list; list.push_back(45); list.push_back(35); list.push_back(65); maxMinAve(list); return 0; } void maxMinAve(vector<int> list){ const int cnt = list.size(); int min = list[0]; int max = min; int sum = min; for(int i = 1; cnt > i; i ++){ sum += list[i]; if(min > list[i]) min = list[i]; if(max < list[i]) max = list[i]; } float avg = (sum/(1.0f*cnt)); cout << "min: " << min << endl; cout << "max: " << max << endl; cout << "avg: " << avg << endl; } Download

✔ Python Code ⚡ Find square and cube of 0 to 5 🔥 Tecq Mate Tutorials ✌

Image
print("number\tsquare\tcube") for n in range(6): print("%6d\t%6d\t%4d" % (n, (n*n), (n*n*n)))

⚡ Windows CMD format drive, list all drive names, convert fat to NFTS

Image

✔ Go lang ⚡ Reading user input from keyboard or stdin 🔥 Tecq Mate Tutorials

Image
package main import "bufio" import "os" func main(){ rd := bufio.NewReader(os.Stdin) print("type & enter: ") ln, er := rd.ReadString('\n') if nil != er { panic(er) } print("you entered: ", ln) }

✔ Go lang ⚡ Sum of all cmd/bash arguments 🔥 Tecq Mate Tutorials ✌

Image

✔ HTML 5 ⚡ How to read excel file with JavaScript 🔥 Tecq Mate Tutorials ✌

How to read excel file with HTML 5 JavaScript? <input type="file" onchange="process(this.files[0])"/> <script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.13.5/xlsx.full.min.js" type="text/javascript"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.13.5/jszip.js" type="text/javascript"></script> <script type="text/javascript"> function process(file) { var regex = /^([a-zA-Z0-9\s_\\.\-:])+(.xls|.xlsx)$/i; if (regex.test(file.name)) { if (typeof (FileReader) != "undefined") { var reader = new FileReader(); if (reader.readAsBinaryString) { reader.onload = function (e) { loadData(e.target.result); }; reader.readAsBinaryString(file); } else { reader.onload = function

✔ MYSQL in C ⚡ Select rows from mysql using c program 🔥 Tecq Mate Tutori...

Image
Download

✔ MySQL + C ⚡ How to connect MySQL in C Program 🔥 Tecq Mate Tutorials ✌

Image
Download

✔ Speed Test ⚡PHP v/s Python v/s Golang v/s C 🔥 Tecq Mate Tutorials ✌

Image
Download

✔ C Programming ⚡ How to make threads in C program? 🔥 Tecq Mate Tutorials ✌

Image
Download

✔ Go Lang Tutorial ⚡ Hello World 🔥 Tecq Mate Tutorials ✌

Image