Skip to content

Instantly share code, notes, and snippets.

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

Divyansh Bhardwaj (DBC) dbc2201

💻
I may be slow to respond.
  • Chandigarh, India
  • 08:59 (UTC +05:30)
View GitHub Profile
@dbc2201
dbc2201 / DemoList.java
Created January 16, 2019 04:07
Code for List ADT in class section 2G
package list;
import java.util.Arrays;
public class DemoList
{
int[] list = new int[10];
public static void main(String[] args)
{
@dbc2201
dbc2201 / DemoList.java
Created January 15, 2019 04:23
Code for List ADT in class
package list;
public class DemoList
{
int[] list = new int[10];
public static void main(String[] args)
{
DemoList list1 = new DemoList();
@dbc2201
dbc2201 / largest_prime_factor.c
Created December 6, 2018 09:25
A program in C to find out the largest prime factor of a number
#include <stdio.h>
#include<math.h>
long long m(long long n)
{
long long max=-1;
while(n%2==0)
{
max=2;
n/=2;
@dbc2201
dbc2201 / year.c
Last active December 4, 2018 14:30
A program in C to find out the day on a particular date.
/*
* Filename : year.c
* Author : Aryan Garg, B. Tech 1st Year, GLAU
* Modifier : Divyansh Bhardwaj, Technical Trainer, GLAU
* Aim : To find the day of the week on a given date.
* */
#include<stdio.h>
int main()
{
int year = 0, date = 0, month = 0, last_two_digits = 0, temp_m = 0, temp_l = 0,
@dbc2201
dbc2201 / swap.c
Created November 29, 2018 11:23
Swap two variables using pointers. Call By Reference
#include <stdio.h>
void swap(int *a1, int *b1);
int main()
{
int a = 4, b = 5;
printf("a = %d b = %d\n", a, b);
swap(&a, &b);
printf("a = %d b = %d\n", a, b);
@dbc2201
dbc2201 / challenge_morse.md
Last active February 17, 2021 16:56
Morse Code Coding Challenge

🔥 Coding Challenge 🔥

You know Morse Code, right? No? Too bad! Google It!

You were supposed to message your significant other during my class. But alas! I will catch your mobile phones if you take them out during the class. So, how do you do that? Simple! On a piece of paper. But wait a minute, you don't want the message to be seen or read by any other students. So, you decide to encode it in Morse Code. Why? Because.

So, write a program in Java for yourself, so that you enter a message and the program converts that message into Morse Code Equivalent. Create a function for the same.

Example

@dbc2201
dbc2201 / array_subtraction.c
Created November 28, 2018 18:37
Matrices Subtraction
#include<stdio.h>
void main()
{
int arr1[2][3]={{7,7,7},{8,8,8}};
int arr2[2][3]={{5,5,5},{5,5,5}};
int i,j;
printf("the first matrix is:)\n");
for(i=0;i<2;i++)
{
for(j=0;j<3;j++)
@dbc2201
dbc2201 / basix2.c
Created November 28, 2018 11:30
working of if-else-if ladder
#include<stdio.h>
int main()
{
int a, b = 5, c = 12;
printf("Enter an integer value:\n");
scanf("%d", &a);
if ( a > 10 )
{
#include<stdio.h>
int main()
{
int a, b = 5, c = 12;
printf("Enter an integer value:\n");
scanf("%d", &a);
if (a > 10)
{
printf("%d is greater than 10.\n", a);
@dbc2201
dbc2201 / arraybasix.c
Created November 28, 2018 09:33
basic array code
#include<stdio.h>
int main()
{
// declaring an integer array of size 10
int array1[10];
// declaring an float array of size 10
float array2[10];
// declaring an double array of size 10