Sunday, 30 June 2019

Program to check a Number is Negative or Positive

Input :-


Outputs : -








Code :- 


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a;

    printf("Enter a number : \n");
    scanf("%d", &a);
    if
        (a<0)
        printf("The number is negative\n");
    else if
        (a==0)
        printf("You Entered Zero\n");
    else
        printf("The number is positive\n");
    return 0;

}


Tuesday, 25 June 2019

To check a year is leap or not in C

To check a year is leap or not in C


Input :



Output : 







Code :

#include <stdio.h>

int main()
{
  int c;
  printf("Enter the year :\n");
  scanf("%d",&c);
{if ((c%4==0)&&(!(c%100==0)||(c%400==0)))
    printf("The year is a leap year\n");
    else
        printf("The year is not a leap year\n");
}
return 0;
}



















To check whether a number is divisible by 6 and 4

To check whether a number is divisible by 6 and 4

Input : 

Output : 



Code :

#include <stdio.h>

int main()
{
  int c;
  printf("Enter a number :\n");
  scanf("%d",&c);
{ if ((c%6==0) && (c%4==0))
    printf("The number is divisible by 6 and 4\n");
    else
        printf("The number is not divisible by 6 and 4\n");
}
return 0;
}

Monday, 24 June 2019

To Check whether a number is prime or not

To Check whether a number is prime or not

Input:-




Output:-

1)




2)






 Code:-

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,i,ans;

    printf("Enter a number : \n");
    scanf("%d",&a);
    for(i=2; i<=a/2;i++ )
        ans=a%i;

{


        if ( ans==0)


            printf("The number is not prime ");


        else
            printf("The number is  prime ");
    }

    return 0;
}































































Program to check divisibility by 5

Program to check divisibility by 5

Input: 


 Output:

 1)

 

 2)



Code:

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a;

    printf("Enter a number : \n");
    scanf("%d",&a);
    {


        if ( a%5==0)


            printf("The number is divisible by 5  ");
        else
            printf("The number is not divisible by 5 ");
    }

    return 0;
}


















Sunday, 23 June 2019

Program to check a number is Even or Odd


Program to check a number is Even or Odd

Input :-























Output :- 

1)








2)









Code :- 

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a;


    printf("Enter a number : \n");
    scanf("%d",&a);
  {

    if (a%2==0)
        printf("The number is even\n\n");
    else
        printf("The number is odd\n\n");
  }
    return 0;

}

C Program to check sum is less than or greater than hundred


C Program to check sum is less than or greater than hundred
Input :-






Output :- 
1) 




2)




3)





Code :- 

#include <stdio.h>
#include <stdlib.h>

int main()
{
int a, b,c;

printf("Enter a number \n");
scanf("%d",&a );
printf("Enter another number \n");
scanf("%d",&b);
c=a+b;
printf("The Sum is = %d\n\n",c);
{
if (c<100)
printf("The Sum Is Less Than Hundred \n\n\n");
else if (c==100)
printf("The sum is hundred");
else
printf("The sum is greater than hundred \n\n\n\n");
}
return 0;
}















Saturday, 22 June 2019

Lecture 53 Preincrement , PostIncrement Operators in C

                                                                                                                                                                          Preincrement  , PostIncrement  Predecrement  , Postdecrement Operators in C                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

Lecture 52 The C preprocessor

                                                                                                                                                                              The C Preprocessor                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              

Lecture 51 Practices for writing larger programs in C

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Lecture 50 Doubly link List

                                                                                                                                                                                                                                                                                                                                                      Doubly link List                                                                                                                                                                                                                                                                                                                                                                                                                                       

Lecture 49 Link list

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Link list                                                                                                                                                                                            

Lecture 48 Pointers to Structures

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     

Lecture 47 Structures in C

                                                                                                                                                                                                                                                                                                                                      Structures in C                                                                                                                                                                                                                                                                                                                                                                                                                             

Codecademy Code Foundations

Popular Posts

Categories

Android (23) AngularJS (1) Assembly Language (2) Books (10) C (75) C# (12) C++ (81) Course (1) Data Strucures (4) Downloads (1) Engineering (13) flutter (1) FPL (17) Hadoop (1) HTML&CSS (40) IS (25) Java (89) Leet Code (4) Pandas (1) PHP (20) Projects (19) Python (423) R (69) Selenium Webdriver (2) Software (14) SQL (27)