Skip to content

Instantly share code, notes, and snippets.

Sandeepa Nadahalli snadahalli

Block or report user

Report or block snadahalli

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

Keybase proof

I hereby claim:

  • I am snadahalli on github.
  • I am snadahalli ( on keybase.
  • I have a public key ASC9T8GbT8mh26-3Ueg0xikukd4b6iI8GhO8gFlH7AB8Two

To claim this, I am signing this object:

snadahalli / number_to_words.c
Last active Nov 4, 2017
C Program to convert number to words
View number_to_words.c
void main() {
long num, div, n1;
int flag, digit, pos, tot_dig;
printf("\nEnter a number: ");
scanf("%ld", &num);
if(num == 0) {
snadahalli / goto.c
Created Oct 9, 2017
Simple C program to demonstrate goto statement
View goto.c
#include <stdio.h>
#include <stdlib.h>
char data[100];
double num1, num2;
printf("\nPlease enter a number ==> " );
snadahalli / isLocked.cs
Created Sep 20, 2017
Check if a file is locked
View isLocked.cs
public static bool IsFileLocked(FileInfo file) {
FileStream stream = null;
return false;
try {
stream = file.Open(FileMode.Open, FileAccess.Read, FileShare.None);
} catch (IOException) {
// the file is unavailable because it is:
snadahalli / greed_coin_changer.c
Last active Sep 20, 2017
A simple solution for Change-making problem based on greedy method.
View greed_coin_changer.c
#include <stdio.h>
int main () {
int num_denominations, coin_list[100], use_these[100], i, owed;
printf("Enter number of denominations : ");
scanf("%d", &num_denominations);
printf("\nEnter the denominations in descending order: ");
for(i=0; i< num_denominations; i++) {
snadahalli / bfs.c
Created Sep 11, 2017
Breadth First Search(BFS) Program in C.
View bfs.c
int a[20][20], q[20], visited[20], n, i, j, f = 0, r = -1;
void bfs(int v) {
for(i = 1; i <= n; i++)
if(a[v][i] && !visited[i])
q[++r] = i;
if(f <= r) {
visited[q[f]] = 1;
snadahalli / day_of_birth.c
Last active Sep 8, 2017
C Program to find the day(of week) of birth from a given Date of Birth.
View day_of_birth.c
int main() {
int d, m, y, year, month, day, i;
printf("Enter date of birth (DD MM YYYY) :");
scanf("%d %d %d", &d, &m, &y);
if( (d > 31) || (m > 12) || (y < 1900 || y >= 2100) )
snadahalli / magic_square.c
Last active Dec 12, 2018
C Program to check if a given matrix is a magic square matrix or not.
View magic_square.c
#include <stdio.h>
void main() {
int A[50][50];
int i, j, M, N;
int size;
int rowsum, columnsum, diagonalsum;
int magic = 0;
printf("Enter the order of the matrix:\n");
scanf("%d %d", &M, &N);
snadahalli / increment_decrement.c
Created Sep 5, 2017
C Program to demonstrate the working of increment and decrement operators.
View increment_decrement.c
/* C Program to demonstrate increment and decrement operators */
* ++i -> i incremented before i is used.
* --i -> i decremented before i is used.
* j++ -> j is incremented AFTER j has been used.
* j-- -> j is decremented AFTER j has been used.
snadahalli / binary_to_decimal.c
Created Aug 11, 2017
Binary to Decimal C Program
View binary_to_decimal.c
* Function to convert a given binary number to
* its decimal equivalent.
int binary_to_decimal(int num) {
int rem, base = 1, decimal_number = 0;
while( num > 0) {
rem = num % 10;
You can’t perform that action at this time.