Skip to content

Instantly share code, notes, and snippets.

Avatar

Faisal Ahmed faisal95bd

View GitHub Profile
@faisal95bd
faisal95bd / remove_duplicates_values.c
Created Nov 6, 2022
Remove duplicate values from an array
View remove_duplicates_values.c
#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 Oct 27, 2022
3 - Reverse string
View reverse_string.c
#include <stdio.h>
#include <string.h>
int main()
{
char str[100], strmain[100], strup[100];
@faisal95bd
faisal95bd / array_largest_number.c
Created Oct 27, 2022
2 - array_largest_number.c
View 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 Aug 23, 2022
Detect Power of Two
View power-of-two.c
#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);
View Categorize.c
#include <stdio.h>
int main()
{
char ch;
printf("Please enter any character: ");
scanf("%c", &ch);
@faisal95bd
faisal95bd / game.c
Last active Aug 14, 2022
Number guessing game between 2 players
View game.c
#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 Aug 6, 2022
Make prices show only after the user selects the variations (WooCommerce)
View gist:fcf2d91e85d9332b77d471c86cf21bcf
//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 Apr 13, 2022
Convert time given in seconds to hours, minutes and seconds
View timeConverter.c
#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 Apr 13, 2022
Calculate the total distance travelled with the formula (s = ut+1/2at2)
View displacement.c
#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: ");