Home / Harshit Tandon (page 10)

Harshit Tandon

c program to print the desired shape empty or filled

First parameter should be a character to choose the shape that will be printed. It could be ‘T’ or ‘t’ for triangle, ‘R’ or ‘r’ for rectangle, ‘P’ or ‘p’ for parallelogram, ‘D’ or ‘d’ for diamond. Second parameter should be a number which identifies the height of the shape. The height should be minimum 2 for triangle, rectangle and ...

Read More »

C program to remove extra blank spaces from a file

Many a times is happens that when you copy content from a incompatible source then extra spaces are added which is due to mismatched format. To get rid of this here is program in c to remove extra blank spaces from a file.. In this content of a file are added to a new file named newfile.txt which contains content ...

Read More »

C program to remove extra lines or blank lines from a file

C program for removing line spacing from a file and copying it to another file or program to remove extra blank lines within a file. #include <stdio.h> #include <stdlib.h> int main() { FILE *fp,*fp2; int p; char *filename; printf("enter the file name from which you have to remove the blank lines: "); scanf("%s",filename); printf("%s",filename); fp=fopen(filename,"r"); fp2=fopen("newfile.txt","w"); //all the content gets ...

Read More »

Block puzzle or jigsaw puzzle program in python

This is a program for block puzzle in python. A jigsaw puzzle that can be a 8 block puzzle , 15 block puzzle etc is given here. The puzzle has N 2  – 1 blocks available to solve. All you have to do is to match the broken blocks pattern with the original image. Here is the n block puzzle ...

Read More »

Java program for binary to decimal conversion

This is a java program to convert a binary number to decimal number: Where the concept is quite simple to do so- Step 1: extract digits from last   (using number%10) and then making number = number/10; Step 2: Digit * 2place value of digit Multiplying the digits from last with the 2 to the power of position of the ...

Read More »

Program for smith number in Java

This is a program in java to check whether a number is a  or not. import java.io.*; class smithnumber { static int sumdigit(int x) //to find the sum of digits { int sum=0; if(x!=0) sum+=x%10+sumdigit(x/10); return sum; } static int sumfact(int x) { int i,fact=0; for(i=2;i<=x;i++) { if(prime(i)) { while(x%i==0) { fact+=sumdigit(i); x/=i; } } } return fact; } static ...

Read More »

Anagram Generator in python

Here is a python program for anagram generator in python language. Read here to know about what is an anagram def anagram(s): n=len(s) if n == 1: return s sb=[] for i in range(n): sb.append(s[i]) rval=anagram(s[0:i]+s[i+1:n]) if isinstance(rval,str): sb[i]=sb[i]+rval if isinstance(rval,list): c=sb[i] sb[i]=[c language="+rval[x"][/c] for x in range(len(rval))] if(n==2): return sb else: c=[sb[x][h] for x in range(len(sb)) for h in ...

Read More »

Java program to translate english to piglatin form

This is a program to convert a english word into piglatin form: Piglatin form: Any word is converted into piglatin form by starting the word from the first vowel and adding the remaining part in the end followed by “AY” import java.io.*; class piglatin { public static void main(String args[])throws Exception { String a; char c;int i,l; System.out.println("Enter a word"); ...

Read More »

C program for Lamport Logical Clock

Lamport Logical Clock C program

Lamport Logical Clock to find the ordering of events in a Distributed System. In Lamport Algorithm each event has its own timestamp which depends on the occuring of events in the order the message has been sent by which event of a process to whichever event. #include<stdio.h> #include<conio.h> int max1(int a, int b) //to find the maximum timestamp between two ...

Read More »

Corporate Training Myths

Nam faucibus imperdiet lacus, vitae dictum leo elementum non. Curabitur sed condimentum velit. Nunc tempor velit at purus mollis venenatis. In hendrerit gravida urna ac congue. Sed fermentum a ipsum non ultricies. Sed quis porttitor nulla, ut dignissim eros. Suspendisse ultricies mauris in arcu commodo, sagittis convallis ante pharetra. Phasellus pharetra odio lorem, ac adipiscing eros ultricies ac. Vivamus ut ...

Read More »