Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

Header file



Comment



Working with switch case



Iterative statement



Test expression




Function_ convert positive to negative and vice versa




// 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 n); int main() { int a,res; printf("Enter any number: "); scanf("%d",&a); //function call res=fact(a); printf("\nThe opposite sign of given number is:\t%d",res); return 0; } //function definition int fact(int n) //function header //function body { int m; m=-n; //converting number return m; }
OUTPUT:


© 2018 - All rights reserved