Task Selector ( C programming language)

#include<stdio.h>
#include<time.h>
int main() {
    char input[100][100];
    srand(time(NULL));
    int n;
    printf("how many tasks you want to input.\n");
    scanf("%d",&n);
    int r = rand();
    r = r % (n + 1);
    if(r == 0) {
        printf("try again");
    }
    for(int i = 0; i < n; i++) {

        printf("\ntask %d:- ", i+1);
        scanf(" %99[^\n]", input[i]);
    }

    printf("\nyour task is \n");

    printf("%s", input[r - 1]);
}

Comments

Popular posts from this blog

AI and Human Evolution

Snake Game using JAVA

To Do List App (GUI) using C#