Skip to content

Instantly share code, notes, and snippets.

View faisal95bd's full-sized avatar

Faisal Ahmed faisal95bd

View GitHub Profile
@faisal95bd
faisal95bd / remove_duplicates_values.c
Created November 6, 2022 18:00
Remove duplicate values from an array
#include <stdio.h>
int main()
{
int arr[100];
int size;
int i, j, k;
printf("Enter size of the array or total numbers : ");
scanf("%d", &size);
@faisal95bd
faisal95bd / reverse_string.c
Last active October 27, 2022 14:08
3 - Reverse string
#include <stdio.h>
#include <string.h>
int main()
{
char str[100], strmain[100], strup[100];
@faisal95bd
faisal95bd / array_largest_number.c
Created October 27, 2022 13:20
2 - array_largest_number.c
#include <stdio.h>
int main() {
int arr[30], i;
printf("Enter the thirty numbers\n\n");
for (int i = 0; i < 30; ++i) {
printf("Enter number%d: ", i + 1);
scanf("%d", &arr[i]);
@faisal95bd
faisal95bd / power-of-two.c
Created August 23, 2022 06:29
Detect Power of Two
#include<stdio.h>
int main() {
int num;
printf("Enter a positive nonzero integer\n");
scanf("%d", &num);
if(num && ((num & (num-1)) == 0)){
printf("Yes", num);
#include <stdio.h>
int main()
{
char ch;
printf("Please enter any character: ");
scanf("%c", &ch);
@faisal95bd
faisal95bd / game.c
Last active August 14, 2022 07:12
Number guessing game between 2 players
#include <stdio.h>
int main() {
int X, n1, n2, n3, i;
printf("Player 1 - Please enter your secret number: ");
scanf("%d", &X);
printf("Player 2 - Please enter your first guess now: ");
scanf("%d", &n1);
@faisal95bd
faisal95bd / gist:fcf2d91e85d9332b77d471c86cf21bcf
Created August 6, 2022 08:19
Make prices show only after the user selects the variations (WooCommerce)
//Hide Price Range for WooCommerce Variable Products
add_filter( 'woocommerce_variable_sale_price_html',
'lw_variable_product_price', 10, 2 );
add_filter( 'woocommerce_variable_price_html',
'lw_variable_product_price', 10, 2 );
function lw_variable_product_price( $v_price, $v_product ) {
// Product Price
$prod_prices = array( $v_product->get_variation_price( 'min', true ),
@faisal95bd
faisal95bd / timeConverter.c
Last active April 13, 2022 07:20
Convert time given in seconds to hours, minutes and seconds
#include<stdio.h>
int main() {
int sec, hh, mm, ss;
printf("Enter time in seconds: ");
scanf("%d", & sec);
hh = sec / 3600;
mm = (sec - hh * 3600) / 60;
@faisal95bd
faisal95bd / displacement.c
Last active April 13, 2022 07:15
Calculate the total distance travelled with the formula (s = ut+1/2at2)
#include<stdio.h>
int main() {
float u, a, t, s; // variable declaration
// input statement which take the values
printf("\n Enter initial velocity: ");
scanf("%f", & u);
printf("\n Enter acceleration: ");