Tuesday, 16 January 2018

Time calculation using function

Q : Write a function that takes time in seconds as input and prints it in terms of hours, minutes and seconds.

Solution : 

/*==============================
     Girfa Student Help
     Program : Time calculation using function
     More Program :http://girfahelp.blogspot.in/p/function-programming.html
================================*/
#include<stdio.h>
#include<conio.h>
void time(int);
void main()
{
     int s,h,m;

Array Average using function

Write a function which accepts an array of size n containing integer values and returns the average of all values. Call the function from main program.

Solution : 

/*==============================
     Girfa Student Help
     Program : Array Average using function
     More Program :http://girfahelp.blogspot.in/p/function-programming.html
================================*/
#include<stdio.h>
#include<conio.h>
#define MAX 5
int avg(int*);

Sunday, 14 January 2018

Array multiply using function

Q :  Write a function which receives two integer arrays and creates a third array by multiplying  corresponding elements (elements with same index) and returns it to main program.


Solution : 

/*==============================
     Girfa Student Help
     Program : Multiply two array using function
     More Program :http://girfahelp.blogspot.in/p/function-programming.html
================================*/
#include<stdio.h>
#include<conio.h>
#define MAX 5
void mul(int *,int *,int *);
void print(int *);
void main()
{

     int ar1[MAX],ar2[MAX],ar3[MAX],i;
     clrscr();
     printf("\nInput f

Palindrome number

 Q : Write a program which asks for a integer from the user. It reverses the integer and prints “same” if after reversal the number is same as old number otherwise it prints “not same”.

Solution : 

/*==============================
     Girfa Student Help
     Program : Reverse a number
     More Program :http://girfahelp.blogspot.in/p/loop-c-language.html
================================*/
#include<stdio.h>
#include<conio.h>
void main()
{

     int n,m,r=0;
     clrscr();
     printf("Enter number>> ");
     scanf("%d",&n);
     m=n;
     while(n>0)