top of page


#include <stdio.h>

#include <stdbool.h>


#define N 100


int main() {

bool doors[N] = {false};

int i, j;


for (i = 1; i <= N; i++) {

for (j = i - 1; j < N; j += i) {

doors[j] = !doors[j];

}

}


printf("Doors that are open:\n");

for (i = 0; i < N; i++) {

if (doors[i]) {

printf("%d = close \n", i + 1);

}

}


return 0;

}


Data types : Data types refer to the type of value a variable can store. In computer programming, variables can be classified based on the data type of the value they store. Some common data types include:

  1. Integer: a whole number, either positive or negative (e.g. 42, -100).

  2. Float: a real number, with a decimal point (e.g. 3.14, -0.01).

  3. String: a sequence of characters (e.g. "hello", "goodbye").

  4. Boolean: a value that can either be True or False.

  5. Array: a collection of values of the same data type.

  6. Dictionary: a collection of key-value pairs, where each key is associated with a value.

  7. Object: a user-defined data structure that can contain data and functions.

These data types can be specific to a programming language, and some programming languages may have additional data types not listed here.



#include <stdio.h>


void main() {

int people, job;

int pc=0, jc=0,flag=0;

printf("\nEnter the limit of people : ");

scanf("%d",&people);

printf("\nEnter the limit of jobs : ");

scanf("%d",&job);

int a[people][job];

int res[people][job];

for(pc=0;pc<people;pc++)

{

for(jc=0;jc<job;jc++)

{

printf("\nGive a job or not(0/1)");

scanf("%d",&a[pc][jc]);

}

}

printf("\n\nPeople Vs Jobs\n");

for(pc=0;pc<people;pc++)

{

for(jc=0;jc<job;jc++)

{

printf("%d ",a[pc][jc]);

}

printf("\n");

}

printf("\n\nOutput\n");

for(pc=0;pc<people;pc++)

{

for(jc=0;jc<job;jc++)

{

if(a[pc][jc]==1)

{

if(flag==0)

{

flag=1;

printf("Person %d , Job %d , Allocated \n",pc+1,jc+1);

break;

}

else

{

jc++;

}

}

}

flag=0;

printf("\n");

}

}

bottom of page