Find the reverse of number

Write a program to take a input from user and find is it a palindrome or not?

 

sample input 1

123

sample output

NO

sample input 2

121

sample output

YES

Write a program to print Fibonacci series up-to n.

Take two number from user n,m and print the value of n to the power m ?

sample input

2  3

sample output

8

Write a program to find the frequency of an given digit m in the given integer n

 

sample input

 2   1222

sample output

 3

Break

Write a program to take the input from user until user's input is negative and print the sum of all the positive values

 

sample input

1  2   3   -1

sample output

6


  

    int i;
    for(i=4;i<8;i++)
    {
        printf("Hello world!");
    }

for loop


#include<stdio.h>
void main()
{
    int i;
    for(i=4;i<8;i++)
    {
        printf("%d",i--);
    }
}

#include<stdio.h>
void main()
{
    int i;
    for( ;i<8;)
    {
        printf("%d",i);
    }
}

H/W Questions

Write a program to find the value of series where you have given the value of x and n.

 

Series:

x + x^2 + x^3 + x^4 + .....................+ x^n.

 

Write a program to find the value of series where you have given the value of x and n.

 

Series:

x + (x^2)/2 + (x^3)/3 + (x^4)/4 + .....................+ (x^n)/n.

 

                           Write a program to print the following patterns.

           

             4 3 2 1       1 
             3 2 1         0 1        
             2 1           1 0 1      
             1             0 1 0 1    

"For" Loop

By Sushil Khanchi

"For" Loop

  • 608