Breaking News

C

Download Turbo C++/ C For Windows10

  Turbo C is an Integrated Development Environment and compiler for the C programming language from Borland. First introduced in 1987, it was noted for its integrated development environment, small size, fast compile speed, comprehensive manuals and low price. In May 1990, Bore-land replaced Turbo C with Turbo C++. In 2006, Bore-land reintroduced the Turbo moniker. Here we are with ... Read More »

Programe to check wether the given word is anagram or not in C

#include <stdio.h> int check_anagram(char [], char []); int main() { char a[100], b[100]; int flag; printf("Enter first stringn"); gets(a); printf("Enter second stringn"); gets(b); flag = check_anagram(a, b); if (flag == 1) printf(""%s" and "%s" are anagrams.n", a, b); else printf(""%s" and "%s" are not anagrams.n", a, b); return 0; } int check_anagram(char a[], char b[]) { int first[26] = {0}, ... Read More »

Program to read a file in C

#include <stdio.h> #include <stdlib.h> int main() { char ch, file_name[25]; FILE *fp; printf("Enter the name of file you wish to seen"); gets(file_name); fp = fopen(file_name,"r"); // read mode if( fp == NULL ) { perror("Error while opening the file.n"); exit(EXIT_FAILURE); } printf("The contents of %s file are :n", file_name); while( ( ch = fgetc(fp) ) != EOF ) printf("%c",ch); fclose(fp); ... Read More »

Program to copy files in C

#include <stdio.h> #include <stdlib.h> int main() { char ch, source_file[20], target_file[20]; FILE *source, *target; printf("Enter name of file to copyn"); gets(source_file); source = fopen(source_file, "r"); if( source == NULL ) { printf("Press any key to exit...n"); exit(EXIT_FAILURE); } printf("Enter name of target filen"); gets(target_file); target = fopen(target_file, "w"); if( target == NULL ) { fclose(source); printf("Press any key to exit...n"); ... Read More »

Program to merge two files in C

#include <stdio.h> #include <stdlib.h> int main() { FILE *fs1, *fs2, *ft; char ch, file1[20], file2[20], file3[20]; printf("Enter name of first filen"); gets(file1); printf("Enter name of second filen"); gets(file2); printf("Enter name of file which will store contents of two filesn"); gets(file3); fs1 = fopen(file1,"r"); fs2 = fopen(file2,"r"); if( fs1 == NULL || fs2 == NULL ) { perror("Error "); printf("Press any ... Read More »

Program to delete a file in C

#include<stdio.h> main() { int status; char file_name[25]; printf("Enter the name of file you wish to deleten"); gets(file_name); status = remove(file_name); if( status == 0 ) printf("%s file deleted successfully.n",file_name); else { printf("Unable to delete the filen"); perror("Error"); } return 0; } Output Enter the name of file you wish to delete hello.c hello.c file deleted successfully. Read More »

Program to add two complex numbers in C

#include <stdio.h> struct complex { int real, img; }; int main() { struct complex a, b, c; printf("Enter a and b where a + ib is the first complex number.n"); printf("a = "); scanf("%d", &a.real); printf("b = "); scanf("%d", &a.img); printf("Enter c and d where c + id is the second complex number.n"); printf("c = "); scanf("%d", &b.real); printf("d = ... Read More »

Program to insert an element in an array in C

#include <stdio.h> int main() { int array[100], position, c, n, value; printf("Enter number of elements in arrayn"); scanf("%d", &n); printf("Enter %d elementsn", n); for (c = 0; c < n; c++) scanf("%d", &array[c]); printf("Enter the location where you wish to insert an elementn"); scanf("%d", &position); printf("Enter the value to insertn"); scanf("%d", &value); for (c = n - 1; c >= ... Read More »

Program for binary search in C

#include <stdio.h> int main() { int c, first, last, middle, n, search, array[100]; printf("Enter number of elementsn"); scanf("%d",&n); printf("Enter %d integersn", n); for ( c = 0 ; c < n ; c++ ) scanf("%d",&array[c]); printf("Enter value to findn"); scanf("%d",&search); first = 0; last = n - 1; middle = (first+last)/2; while( first <= last ) { if ( array[middle] ... Read More »

Program to add two numbers using pointers in C

#include <stdio.h> int main() { int first, second, *p, *q, sum; printf("Enter two integers to addn"); scanf("%d%d", &first, &second); p = &first; q = &second; sum = *p + *q; printf("Sum of entered numbers = %dn",sum); return 0; } Output Enter two integers to add 5 3 Sum of entered numbers =8 Read More »