Showing posts with label Check. Show all posts
Showing posts with label Check. Show all posts

CHECKING LEAP YEAR USING C PROGRAM.

How To CHECKING LEAP YEAR USING C PROGRAM.


#include<stdio.h>#include<conio.h>void main(){    int year;    clrscr();    printf("Enter any year: ");    scanf("%d",&year);    if(((year%4==0)&&(year%100!=0))||(year%400==0))         printf("%d is a leap year",year);    else         printf("%d is not a leap year",year);    getch();}

Check given number is prime number or not using c program.

How To Check given number is prime number or not using c program.


#include<stdio.h>
int main(){
    int num,i,count=0;
    printf("\nEnter a number:");
    scanf("%d",&num);
    for(i=2;i<=num/2;i++){
        if(num%i==0){
         count++;
            break;
        }
    }
   if(count==0)
        printf("%d is a prime number",num);
   else
      printf("%d is not a prime number",num);
   return 0;

}

Write a c program to check given string is palindrome number or not.

How to Write a c program to check given string is palindrome number or not.


#include<string.h>
#include<stdio.h>
int main(){
  char *str,*rev;
  int i,j;
  printf("\nEnter a string:");
  scanf("%s",str);
  for(i=strlen(str)-1,j=0;i>=0;i--,j++)
      rev[j]=str[i];
      rev[j]='\0';
  if(strcmp(rev,str))
      printf("\nThe string is not a palindrome");
  else
      printf("\nThe string is a palindrome");
  return 0;
}

C Program to Check Prime Use Loop And Recursive

How to write a C Program to Check Prime Use Loop And Recursive in C Programming Language ?


Solution For C Program :
/*Check Prime Use Loop And Recursive*/