Posts

Showing posts with the label cprog

List of C Programs that makes u understand concepts in an easy fashion(Part1)

A very Good Day to all my Readers, Today i received a Query Regarding solutions towards common C programs, using which one can understand the concepts of C in easy Way. So here is a complete Ready To Use Solution Kit for you reader Program 1 Program to print A to Z along with equivalent ASCII Value main() { int ch,c; clrscr(); c=1; ch=65; printf("Alphabet\t\t ASCII Value\n"); while(c<=26) { printf("%c",ch); printf("\t\t%d",ch); printf("\n"); ch=ch+1; c=c+1; } getch(); } Program 2 : Write C program to calculate Factorial of given Number main() { int fact,num; clrscr(); printf("Enter Any Number:"); scanf("%d",&num); fact=1; while(num>=1) { fact=fact*num; num=num-1; } printf("Factorial is %d",fact); getch(); } Program 3   Program to calculate Sum of first n natural numbers #include <stdio.h> main() { int n,t...

Implementing Concept of Files, Linked List and Structures all together in C

C has always been a tedious task to learn.Understanding concepts with simple implementation, makes it easy for new programmers . Here , I am giving you the practical implementation for the Advanced C Concepts of Structures, File and Linked List  # include <stdio.h> struct employee {      int emp_code;      char emp_name[20]; }; struct slist {    int ecode;    char ename[20];     struct slist *next; }; struct slist *fp,*ep,*p,*temp,s; struct employee  emp; main() {    int ch;    FILE *fp1;    fp=NULL; // when the list has not been created yet, pointer to first node is set to NULL    ep= NULL; // Last Node Pointer also set to NULL    fp1=fopen("emp.dat","r");    if (fp1==NULL)    {         printf("Error Opening File");         getch();         return;     } //start readin...