Posts

Showing posts from February 4, 2018

Introduction to C Programming | C Programming

Image
Introduction to C Programming ±    C is a general-purpose high level language ±    Father of C – Dennis Ritchie ±    Originally developed for the UNIX operating system ±    Implemented on the Digital Equipment Corporation, PDP-11 computer in 1972 ±    The UNIX operating system and all UNIX applications are written in the C language   C has now become a widely used professional language for various reasons: ±     Easy to learn ±     Structured language ±     It produces efficient programs ±     It can handle low-level activities ±     It can be compiled on a variety of computers Why we use C? ±    C was initially used for system development work, in particular the programs that make-up the operating system ±    C was adopted as a system development language because it produces code that runs nearly as fast as code written in assembly language. ±    Some examples of the use of C might be: °     Operating Systems °     Language Compilers

C Program to Find Area and Perimeter Using function | C Programming

Image
C Program to find the Area and Perimeter of a Rectangle using function Source Code (Finding Area) #include <stdio.h> int area ( int , int ); int main () {     int len , bred , a ;     printf ( "Enter length of rectangle:-\n" );     scanf ( " %d " , & len );     printf ( "Enter breadth of rectangle:-\n" );     scanf ( " %d " , & bred );     a = area ( len , bred );     printf ( "The area is %d " , a );     return 0 ; } int area ( int a , int b ) {     int area ;     area = a * b ;     return area ; } Source Code (Finding Perimeter) #include <stdio.h> int perimeter ( int , int ); int main () {     int len , bred , p ;     printf ( "Enter length of rectangle:- \n " );     scanf ( " %d " , & len );     printf ( "Enter breadth of rectangle:- \n " );     scanf ( " %d " , & bred );     p = perimeter ( len , bred );     printf ( "The perimeter is %d .&quo

C Program to check whether the current year is a leap year or not | C Programming

Image
C Program to check whether the current year is a leap year or not #include <stdio.h> int main () {   int a ;   printf ( "Enter the current year:" );   scanf ( " %d " , & a );   if ( a % 4 == 0 && a % 100 == 0 && a % 400 == 0 )     printf ( "It is a leap year." );   else if ( a % 4 == 0 && a % 100 != 0 )     printf ( "It is a leap year." );   else     printf ( "It is not a leap year." );   return 0 ; } Output