Thursday, 23 June 2022

C Programming - If Else condition - Session 9


C Programming - If Else condition - Session - 9 - Months


This session is a continuation of the previous session as we'll discuss on the assignments given in the previous session.





Please watch the video for the full session - 9: 




The following is the chat and other information exchanged during the session-9:


 Jameela a8:39 PM

#include<stdio.h>

void main()

{

  char c ;

  printf ("check the character falls between A to E\n");

  scanf ("%c", &c);

  if ((c >= 'a' && c <= 'e') || (c >= 'A' && c <= 'E'))

    {

      printf ("yes");

    }

  else

    {

      printf ("no");

    }

}

Thameem9:01 PM

#include <stdio.h>


int main()

{

    int a;

    printf("enter the number/n");

    scanf ("%d",&a);

    If (a>=1 && a<=5)

    {

        printf("Yes");

    }

    else

    {

        printf("No");

    }

    }

Thameem9:06 PM

2)

#include <stdio.h>


int main()

{

   int a = 10;

   int b = 20;

   if (a < b)

   {

   printf("Maximum = %d\n",b);

}

}

Jameela a9:07 PM

#include <stdio.h>

void main ()

{

int a, b;

printf("find the maximum between two number\n");

printf("enter first number\n");

scanf("%d", &a) ;

printf(" enter the second number\n" );

scanf("%d", &b);

if(a>b)

{

printf("a is big number than b");

else

{

printf("b is big number than a");

}

Mohamed Abdulla Aliyar9:11 PM

Understood

karthick Raja9:11 PM

#include<stdio.h>


void main()

{

    char c = 'A';

    printf("Enter a character: ");

    scanf("℅c",&c);

    printf("ASCII value of %c = %d", c, c);

}

Thameem9:11 PM

#include <stdio.h>


int main()

{

    printf("enter the character\n");

    char a;

    scanf("%c",&a);

    printf("%d",a);

}

karthick Raja9:13 PM

#include<stdio.h>


void main()

{

    int a = 10;

    printf("Enter a number: ");

    scanf("%d",&a);

    if(a%2 == 0)

    printf(" is even number");

    else

    printf(" is odd number");

}

Jameela a9:13 PM

#include<stdio.h>

void main()

{

    int n;

    printf("enter value of n");

    scanf("%d",&n);

        if(n%2==0)

      {

          printf("even number");

    }

        else

       {

           printf("odd number");

    }

}

Anjum Parveen9:18 PM

Understood

Mohamed Abdulla Aliyar9:25 PM

👍

Jameela a9:27 PM

#include<stdio.h>

void main()

{

    int n;

    printf("enter the month");

    scanf("%d",&n);

    if("n==1|| n==3|| n==5|| n==7|| n==8|| n==11 n==12")

    {

        printf("It contains 31 Days");

    }

    else("n==4|| n==6|| n==9|| n==10");

    {

        printf("It contains 30 Days");

    }

}

Mohamed Abdulla Aliyar9:49 PM

Thinking

Thameem9:49 PM

#include <stdio.h>


void main()

{

    int a=10;

    printf("enter the month");

    scanf("%d",&a);

    printf(a%2==0 ? "5 apples" : "10 apples");

}

No comments:

Post a Comment