Computer Science, asked by Anonymous, 1 year ago

Hlo all brainly learners.....

Answer that question:

write a program to find out the name of a day in a week according to number (1-7) input by using if -else-ladder statement

No spam please....

answer correctly....​


Anonymous: no...
Anonymous: i am busy dearr
Anonymous: ok
asdfgh40: hiii
asdfgh40: hlo riya
sager1143: hello
asdfgh40: kha se ho bhai
sager1143: nashik

Answers

Answered by Anonymous
7

Answer:

Explanation:This C program will ask the user to enter any number between 1 to 7, where 1 is Monday, 2 is Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday, and 7 = Sunday. Based on the user entered integer value this program will print the day name.

To accomplish this goal we are using Else If Statement. But, we strongly recommend the Switch Case approach, which we explained in the second example.

/* C Program to Print Day Name of Week using Else If Statement */

#include <stdio.h>

int main()

{

 int weekday;

 printf(" Please Enter the Day Number 1 to 7 (Consider 1= Monday, and 7 = Sunday) :  ");

 scanf("%d", &weekday);

 

 if (weekday == 1)

 {

  printf("\n Today is Monday");    

 }

 else if ( weekday == 2 )

 {

  printf("\n Today is Tuesday");    

 }  

 else if ( weekday == 3 )

 {

  printf("\n Today is Wednesday");    

 }  

 else if ( weekday == 4 )

 {

  printf("\n Today is Thursday");    

 }  

 else if ( weekday == 5 )

 {

  printf("\n Today is Friday");    

 }  

 else if ( weekday == 6 )

 {

  printf("\n Today is Saturday");    

 }    

 else if ( weekday == 7 )

 {

  printf("\n Today is Sunday");    

 }  

 else

   printf("\n Please enter Valid Number between 1 to 7");

 

 return 0;


Anonymous: if u like the mark me
Anonymous: hey priya
Anonymous: Sorry riya
Anonymous: I think this is the attitude of a punjab girl
Anonymous: Like @jatti
Anonymous: Thnx to mark me
Similar questions