S

@softwareNuggets

how to use the strtok function in c programming

C
11 months ago
//Youtube: https://www.youtube.com/@SoftwareNuggets //myCompiler https://www.mycompiler.io/@softwareNuggets #include <stdio.h> #include <string.h> int main() { // This is the string we want to split into separate cryptocurrencies

how to use sscanf in c

C
11 months ago
//Youtube: https://www.youtube.com/@SoftwareNuggets //myCompiler https://www.mycompiler.io/@softwareNuggets #include <stdio.h> #include <string.h> int main() { // Example input string char input[] = "BTCabcdefghij .085 114532.65";

C Program - DateTime

C
1 year ago
// Written by Scott Johnson - SoftwareNuggets // Youtube :: https://youtube.com/c/softwareNuggets/ #include <stdio.h> #include <time.h> int main() { time_t now; struct tm *timeinfo; char buffer[80];

Understand UNION in C - One Memory Location, Multiple Data Types

C
1 year ago
#include <stdio.h> union Number { short age; // 2 bytes float pi; // 4 bytes }; int main() { // A union lets you store different // data types in the same memory space.

leetcode_Q22_ParenthesesGenerator

C#
1 year ago
using System; using System.Collections.Generic; namespace NSParenthesesGenerator { public class Program { public static void Main() { // This will store all the valid parentheses combinations

understanding scanf part 1

C
1 year ago
#include <stdio.h> int main() { int num=0; printf("Enter a number from 0-100:"); scanf("%d",&num); /* think of scanf performing two tasks: 1) reads the raw input from the user, based on the format specifier (%d for

elementary_closure_example.rs

Rust
1 year ago
fn main() { // Regular function // function name: add_one // function input parameter (x: i32) // function return value: -> i32 //Regular functions never need a semicolon after their closing brace - /

HackerRank: Arrays and String - Printing Tokens

C
1 year ago
#include <stdio.h> #include <stdlib.h> #include <string.h> /* YT: SoftwareNuggets */ int main() { char *token; char delimiter[2] = {' ', '\0'}; char temp[32];

rust - how to use traits

Rust
1 year ago
trait Shape { fn area(&self) -> f64; fn display(&self); } struct Rectangle { width: f64, height: f64 }

calulate_the_weighted_average_prediction_for_temperature

Python
2 years ago
import datetime # This function helps us make a smart guess about tomorrow's temperature def predict_temperature(past_temperatures, weights): """ Calculate the weighted average prediction for temperature. :param past_temperatures:

rust,Error,Debug,HashMap

Rust
2 years ago
use std::collections::HashMap; use std::error::Error; use std::fmt; // Custom error type #[derive(Debug)] struct GradeError { message: String, }

smallest number expressible as a sum of two cubes in two different ways

Python
2 years ago
It is the smallest number expressible as a sum of two cubes in two different ways. # Function to check if a number can be expressed as the sum of two cubes in two different ways def is_special_number(n): # Dictionary to store sums of cubes c

compute cube_sum = a**3 + b**3

Python
2 years ago
limit = 25 # Set an initial limit for a and b, adjust as needed cube_sums = {} cnt = 0 # Generate cube sums and store in dictionary for a in range(1, limit): for b in range(a, limit): cube_sum = a**3 + b**3 cube_sums[cnt] = (a,

a^2+(a*b)+b^2

Python
2 years ago
limit = 1729 sums = {} cnt = 0 # Generate cube sums and store in dictionary for a in range(1, limit): for b in range(a, limit): #equation = a^2+(a*b)+b^2 sum = (a**2) + (a * b) + (b**2)

Lesson 4 - Compute Area of rectangle in Assembly Language.

Assembly
2 years ago
;software nuggets - Lesson 4. ;the registers 64 bits | rax | rbx | rcx | rdx | rbp | rsp | rsi | rdi ; 32 bits | eax | ebx | ecx | edx | ebp | esp | esi | edi ; 16 bits | ax | bx | cx