Posts

Showing posts with the label functions in c

File inclusion in c

There are two ways to include a file in c # include ”filename” #include<filename> 1st one  is search in  current directory  and  specify list of directory  and  it also take full qualified file name. 2nd one  is search in  specify list of director y. But It has a advantage that is it can take  multiple file Name  at a time that is separated by semicolon ( ; ). Example- #include<file 1; file 2; file 3>

Connect to printer by C Program

#include<stdio.h> #include<conio.h> #include<stdlib.h> void main() { FILE *fp; char ch; fp=fopen(" full qulified file name that you want to read ","r"); if(fp==NULL) { printf("can not open file\n"); exit(1); } while((ch=fgetc(fp))!=EOF) { fputc(ch,stdprn); } fclose(fp); getch(); }

Exponential function in c

The exp() function computes the exponential (Euler's number) raised to the given argument. C exp() Prototype double exp(double arg); The exp(arg) takes a single argument and returns the value in type   double . — maths e^x = exp(x) [in c programming] It is defined in  <math.h> header file. EXAMPLE- #include <stdio.h> #include <math.h> int main () { double x = 12.0 , result ; result = exp ( x ); printf ( "Exponential of %.2lf = %.2lf" , x , result ); return 0 ; } Output Enter the value of x to find e ^ x : 12 Exponential of 12.00 = 162754.79