Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

Iterative statement



Comment



Header file



" ; " after loop



Working with switch case




Function_ find leap year




// AHF C PROGRAM SOLVING

//The problem are solving here using FUNCTION

#include<stdio.h> #include<math.h> #define pf printf //function declaration int fact(int); void main() { int a,res; pf("Enter any year: "); scanf("%d",&a); //function call res=fact(a); return 0; } //function definition int fact(int year) //function header //function body { if(year%4 == 0) { if(year%100 == 0) { if(year%400 == 0) pf("\n%d is lesp year.",year); else pf("\n%d is not leap year.",year); } else pf("\n%d is leap year.",year); } else pf("\n%d is not leap year.",year); }
OUTPUT:


© 2018 - All rights reserved