Skip to content

Instantly share code, notes, and snippets.

View dbc2201's full-sized avatar
💻
I may be slow to respond.

Divyansh Bhardwaj dbc2201

💻
I may be slow to respond.
View GitHub Profile
#include <stdio.h>
int main()
{
int number = 48;
if ( number > 48 )
{
printf("The number you entered is %d.\n", number);
}
return 0;
@dbc2201
dbc2201 / source4.c
Created November 20, 2018 17:45
GLA-BCSC0001-2018:Worksheet1:Question4
#include <stdio.h>
int main()
{
int a = 1;
if (a);
{
printf("hello");
}
else
{
#include <stdio.h>
int main(void)
{
int number = 0;
int digit = 0;
int sum = 0;
printf("Enter the five digit number : ");
scanf("%d", &number);
#include <stdio.h>
int main(void)
{
int a = 5;
if ( a > 10 )
{
printf("This was printed from inside if\n");
}
else
#include <stdio.h>
int main()
{
int cp = 0, sp = 0, result = 0;
printf("Enter the CP : ");
scanf("%d", &cp);
printf("Enter the SP: ");
@dbc2201
dbc2201 / bitwise1.c
Created November 22, 2018 19:46
Source Code for the Bitwise operators problem in HackerRank located here https://www.hackerrank.com/challenges/bitwise-operators-in-c/problem
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
//Complete the following function.
void calculate_the_maximum(int n, int k)
{
//Write your code here.
@dbc2201
dbc2201 / shifting.c
Created November 24, 2018 18:09
How to do bit-wise shifting in C
#include <stdio.h>
void dec_to_bin(int n);
int main()
{
int x = 4;
dec_to_bin(x);
printf("\n4 << 1\t");
dec_to_bin(x << 1);
@dbc2201
dbc2201 / electricity_bill.c
Created November 25, 2018 12:18
Sample Answer for Worksheet 6 Question 4
#include <stdio.h>
#include <stdlib.h>
#define SIZE 20
#define METER_CHARGE 50
double make_bill();
int main()
{
make_bill();
@dbc2201
dbc2201 / fibonacci.py
Created November 26, 2018 19:05
a python program to print fibonacci series
def fibonacci_sequence(num1):
list1 = []
if num1 == 0:
list1 = list1
elif num1 == 1:
list1.append(0)
elif num1 == 2:
list1.extend([0, 1])
else:
list1.extend([0, 1])
@dbc2201
dbc2201 / text.py
Created November 26, 2018 19:05
to generate airport text
def generate_text(str1, str2, num1):
print("{}, go to gate {} for flight {}.".format(str1, num1, str2))
generate_text("Sam Roger", "AI221", 12)
generate_text("Tanya Patel", "AC123", 3)