Palindrome number:- #include <stdio.h> main() {
int n, n1, rev = 0, rem; printf("Enter any number: \n"); scanf("%d", &n); n1 = n; while (n > 0)
{ rem = n % 10; rev = rev * 10 + rem; n = n / 10; } if (n1 == rev)
{ printf("Given number is a palindromic number"); } else {
printf("Given number is not a palindromic number"); } return 0; }
#include<stdio.h> int main() { int n,i,count=0; printf("Enter a number: ");
scanf("%d",&n);
for(i=2;i<=n/2;i++) { if(n%i==0) {
count++; break;
}
} if(count==0 && n!= 1) printf("%d is a prime number",n); else printf("%d is not a prime number",n); return 0; }
Program for Fibonacci series #include<stdio.h> main() { int a,b,c,i; clrscr(); a=0; b=1; printf("fibonacci series is\n:%d\t%d\t",a,b); for(i=0;i<5;i++) { c=a+b; a=b; b=c; printf("\t%d",c); } getch(); }
Loop is a statement, it calls itself more than one time, when the condition gets satisfied. (or) C loop statement is used when you want to execute a block of code repeatedly with checked condition before making an iteration.
By using loop we can reduce the duplicate statements.
Conditions of the Variables Condition is a comparison between variables. Conditions are divided in to 5 types. * Single statement condition. // by using symbolic representation.
* Multiple statements condition. // by using symbolic representation.