Computer Science, asked by mounikachilukoti17, 6 months ago

c program for on the eve of the silver jubilee celebrations of the college, the college management has decided to give lucky prizes for students whose enrollment numbers does not contain any even digits.does not start or end with 1

Answers

Answered by anjalisingh6326
0

Answer:

Perhaps the number is 735, 357, 975, 579,793

Answered by arshikhan8123
0

Answer:

Refer to the program in the explanation.

Assumed a few things which can be modified, like the length of str is 10.

Explanation:

#include<stdio.h>

#include<stdbool.h>

bool lucky_prize( int number)

{

   char str[10];

   bool eflag = false;

   sprintf(str, "%d", number);

   if (str[0] == '1' || str[strlen(str) - 1] == '1')

   {

       eflag = true;

   }

    int rem;

         while (number > 0)

         {

                rem = number % 10;

                if (rem % 2 == 0) {

                     eflag = true;

                     break;

              }

              number = number / 10;

         }

    return eflag;

}

void main()

{

    int enroll;

    printf("Enter enrollment number to verify got lucky price");

    scanf("%d", &enroll);

    printf("%d is %s for lucky prize\n", enroll, lucky_prize(enroll) ? "not selected" : "selected");

}

Program above does the necessary.

#SPJ2

Similar questions