HOME

Start

Control Statements

Array

Function

Structure

Pointer

File

Projects

 

 

 

 

 

 

C programing

Ckalari.com is the No.1 website to get the best of C programs, free source codes, projects in c language……  

A C program to do family survey

Download

#include<stdio.h>

#include<conio.h>

void main()

     {

    int h,x1,x2,x3,x4,d1,d2,lh,a,b,c,d,y;

    int i=1,j,k,n,male,fem,pop;

    float upp,low,totalland;

    int hsno[100],norsd[1000],comm[1000];

    char hsnm[100][20],name[100][20];

    int age[1000][8],sex[1000][8],ml[100],fm[100],tp[100],popocc[8];

    float inc[100][8],lnd[100][8],flnd[100],tlnd[8],finc[100],tinc[8];

    for(h=1;h<=100;h++)

    {

    flnd[h]=0;tlnd[h]=0;tinc[h]=0;finc[h]=0;

    popocc[h]=0;ml[h]=0;fm[h]=0;tp[h]=0;

    }

    clrscr();

    do

    {

      printf("  Select from the following menu  \n");

      printf("\n\n***************************************************\n\n");

      printf("1:Enter data \n\n\n");

      printf("2:Survey reprts\n\n\n");

      printf("3:Exit\n\n\n");

      scanf("%d",&d1);

      if(d1==1)

      {

        printf("Enter huse no\n");

        scanf("%d",&hsno[i]);

        printf("Enter house name and number of residence\n");

        scanf("%s%d",hsnm[i],&norsd[i]);

        printf("Select your community\n");

        printf("1.sc 2.st 3.obc 4.gen\n");

        scanf("%d",&x1);

        comm[i]=x1;

        for(j=1;j<=norsd[i];j++)

        {

          printf("Enter name and age of resident %d\n",j);

          scanf("%s%d",name[i][j],&age[i][j]);

          printf("Select sex \n");

          printf("1:MALE   2:FEMALE\n");

          scanf("%d",&sex[i][j]);

          if(sex[i][j]==1)

          ml[x1]++;

          if(sex[i][j]==2)

          fm[x1]++;

          tp[x1]++;

          printf("select occupation\n");

          printf("\n\n***********************************************\n\n");

          printf("1 Salaried person \n");

          printf("2 Business \n");

          printf("3 Aricuture\n");

          printf("4 Casual laborer \n");

          printf("5 student \n");

          printf("6 others \n");

          printf("7 jobless \n");

          scanf("%d",&x2);

          popocc[x2]++;

          printf("Enter income from the following in Rs\n");

          printf("\n\n***********************************************\n\n");

          printf("1 Salary \n");

          printf("2 Business \n");

          printf("3 Land \n");

          printf("4 Pension \n");

          printf("5 Others \n");

          printf("6 No income \n");

          scanf("%d%f",&x3,&inc[i][j]);

          finc[i]=finc[i]+inc[i][j];

          tinc[x3]=tinc[x3]+inc[i][j];

          printf("Enter type of land in hectors\n");

          printf("\n\n************************************************\n\n");

          printf("1.Rubber  \n");

          printf("2.Paddy  \n");

          printf("3.Coconut   \n");

          printf("4.Coffe  \n");

          printf("5.Papper  \n");

          printf("6.Cardom  \n");

          printf("7.Others  \n");

          printf("8.No farming \n");

          scanf("%d%f",&x4,&lnd[i][j]);

          flnd[i]=flnd[i]+lnd[i][j];

          tlnd[x4]=tlnd[x4]+lnd[i][j];

        }

        i++;

 

      }

      else if(d1==2)

      {

        do

        {

          printf("\n\n           Select      \n");

          printf("\n\n************************************************\n\n");

          printf("1.Families of different income limits\n");

          printf("2.Specified income limit\n");

          printf("3.Income Source\n");

          printf("4.Occupation\n");

          printf("5.Areas of different type of land \n");

          printf("6.Population\n");

          printf("7.Details of specified house \n");

          printf("8.Exit\n");

          scanf("%d",&d2);

          if(d2==1)

        {

        a=0;

        b=0;

        c=0;

        d=0;

        lh=0;

        for(j=1;j<=i;j++)

        {

          if(finc[j]<6000)

          a++;

          if(finc[j]<24000&&finc[j]>6000)

          b++;

          if(finc[j]<60000&&finc[j]>24000)

          c++;

          if(finc[j]<300000&&finc[j]>60000)

          d++;

          if(finc[j]>300000)

          lh++;

        }

        printf("Income             No of families\n");

        printf("Below 6000               %d\n",a);

        printf("6-24000                  %d\n",b);

        printf("24-60000                 %d\n",c);

        printf("60-300000                %d\n",lh);

        }

        if(d2==2)

        {

          n=0;

          printf("Enter upper and lower limits\n");

          scanf("%f%f",&upp,&low);

          for(j=1;j<=0;j++);

            {

            if(finc[j]<=upp && finc[j]>low)

            n++;

            }

         printf("%d\n",n);

           }

           if(d2==3)

           {

         printf("Source        Income\n");

         printf("\n************************************************\n\n");

         printf("1.salary       %f\n", tinc[1]);

         printf("2.Busines      %f\n", tinc[2]);

         printf("3.land         %f\n", tinc[3]);

         printf("4.Pension      %f\n", tinc[4]);

         printf("5.Others       %f\n", tinc[5]);

           }

           if(d2==4)

           {

        printf("1.Occupation      No of people\n");

        printf("2.Salaried person     %d\n",popocc[1]);

        printf("3.Business            %d\n",popocc[2]);

        printf("4.Agriculture         %d\n",popocc[3]);

        printf("5.Casual laborer      %d\n",popocc[4]);

        printf("6.Student             %d\n",popocc[5]);

        printf("7.Others              %d\n",popocc[6]);

        printf("8.Jobless             %d\n",popocc[7]);

        }

        if(d2==5)

        {

          printf("Typed land area\n");

          printf("\n\n********************************************\n\n");

          printf("1.Rubber          %f\n",tlnd[1]);

          printf("2.Paddy           %f\n",tlnd[2]);

          printf("3.Coconut         %f\n",tlnd[3]);

          printf("4.coffee          %f\n",tlnd[4]);

          printf("5.Pepper          %f\n",tlnd[5]);

          printf("6.Cardomom        %f\n",tlnd[6]);

          printf("7.Others          %f\n",tlnd[7]);

          printf("8.No farming      %f\n",tlnd[8]);

         totalland=0;

          for(j=0;j<=4;j++)

           totalland=totalland+tlnd[j];

          printf("total             %f\n",totalland);

        }

        if(d2==6)

        {

          printf("\n\nCommunity      Male         Female        Total\n");

          printf("\n\n********************************************\n\n");

          printf("\nSC                 %d            %d           %d\n",ml[1],fm[1],tp[1]);

          printf("\nST                 %d            %d           %d\n",ml[2],fm[2],tp[2]);

          printf("\nOBC                %d            %d           %d\n",ml[3],fm[3],tp[3]);

          printf("\nGeneral            %d            %d           %d\n",ml[4],fm[4],tp[4]);

          male=0;

          fem=0;

          pop=0;

          for(j=1;j<4;j++)

          {

            male=male+ml[j];

            fem=fem+fm[j];

            pop=pop+tp[j];

          }

          printf("\nTotal              %d            %d           %d\n",male,fem,pop);

        }

        if(d2==7)

        {

          printf("Ente house no\n");

          scanf("%d",&y);

          j=1;

          while(hsno[j]!=y)

          j++;

          printf("\nHouse no   %d  \n",hsno[j]);

          printf("House name   %s  \n",hsnm[j]);

          printf("\nNmae             age       income      Land \n");

          for(k=1;k<=norsd[j];k++)

          printf("%s               %d       %f           %f\n",name[j][k],age[j][k],inc[j][k],lnd[j][k]);

        }

          }while(d2!=8);

      }

    }while(d1!=3);

 

    getch();

     }

 

     /*Hai

           We can study c programing in malayalam Using www.ckalari.com .

           It is the first malayalam tutorial website.From this site we

           get many c porgrams, c projects . website Editing tools....etc.

           So please visit www.ckalari.com  */

Copyright © 2007-2008 www.ckalari.com