Wednesday, 17 January 2018

Even Odd group print array

Q : Write a program using function to read an array from the user and print the odd number at odd position and prints the even numbers at even positions. For example input array is 1 2 3 4 and
output is 2 1 4 3.


Solution : 


/*==============================
     Girfa Student Help
     Program : Even Odd group print array
     More Program :http://girfahelp.blogspot.in/p/one-dimentaional-array-programming.html
================================*/
#include<stdio.h>
#include<conio.h>
#define MAX 5
void print(int*);
void main()
{
     int ar[MAX],i;

Count Word Character new line

Q  : Write a Program to count lines, words and characters with a definition that a word is any sequence of characters that does not contain a blank, tab or new line.

Solution :


/*==============================
     Girfa Student Help
     Program : Count Word Character new line
     More Program :http://girfahelp.blogspot.in/p/1.html
================================*/
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
     FILE *pt;
     char ch;
     int character=0,line=1,word=1;
     clrscr();
     pt=fopen("data.txt","r");

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*);