C Programming

Solved Example

Practice Questions

Exercise Question

Population analysis

Objective

In a town, the percentage of men is 52. The percentage of total literacy is 48. If the total percentage of literate men is 35 of the total population, write a program to find the total number of illiterate men and women if the population of the town is 80,000.

Program / Solution:

#include<stdio.h>

#define TOTAL_POPULATION 80000
int main() {
	int total_men,total_women,total_lit,total_lit_men,total_lit_women;
	
	total_men = TOTAL_POPULATION * 52.0f / 100;
	printf("Total Men population: %d\n",total_men);
	
	total_women = TOTAL_POPULATION - total_men;
	printf("Total Women population %d\n",total_women);
	
	total_lit = TOTAL_POPULATION * 48.0f / 100;
	printf("Total Literate population: %d\n",total_lit);
	
	total_lit_men = TOTAL_POPULATION * 35.0f / 100;
	printf("Total Literate men population: %d\n",total_lit_men);
	
	total_lit_women = total_lit - total_lit_men;
	printf("Total Literate women population: %d\n",total_lit_women);
	
	
	return 0;
}

Sample Output:

Total Men population: 41600
Total Women population 38400
Total Literate population: 38400
Total Literate men population: 28000
Total Literate women population: 10400