Sunday, 7 February 2016

First Assignment on Decision Statements and Loops for B.Tech CSE, 2nd Sem students,B1 and B2

Dear Students,

Find below your first assignment on decision statements and loops.


1.          WAP to find out whether input letter is vowel or not.
2.          WAP to print following patterns:
1                                                    *                                             * * * * *
1 2                                                 * *                                         * * * *
1 2 3                                             * * *                                       * * *
1 2 3 4                                         * * * *                                     * *
1 2 3 4 5                                      * * * * *                                 *
3.       WAP to enter numbers till the user wants. At the end it should display the count of positive, negative and zero entered.
4.       WAP to read the age of 100 persons and count the number of persons in the age group 50 to 60. Use FOR and CONTINUE statement.
5.      WAP to print all integers that are not divisible by either 2 or 3 and lie between 1 and 100. Program should also account the number of such integers and print the result.
6.         WAP to input 10 integers (both positive and negative) and compute the sum of all positive values and print the sum and number of values added. The program should terminate if the sum exceeds 30.
7.          WAP to find out sum of digits of a given number.
8.          WAP to print reverse of number inputted through the keyboard.
9.          WAP to find out a raised to power b using loops.
10.       What will be the output of following program?                                                                                         
                                                                                                                                                                                                         
                void main()
                {
                                int x=4,y=0,z;
                                while(x>=0)
                                {
                                    x--;
                                    y++;
                                    if(x==y)
                                                continue;
                                    else
                                                printf(“\n%d%d”,x,y);
                                }
                }
11.          An Armstrong number is the one in which the sum of cubes of its digit is equal to the number itself. The program takes a number as input and output whether the given number is an Armstrong number or not. For example: (a) 371 is an Armstrong Number as 27+343+1=371 (b) 153 is an Armstrong Number (1+125+27=153) (c) 42 is not an Armstrong Number (64+8=72).
12.          Three numbers form a Pythagorean triple if the sum of squares of two numbers is equal to the square of the third. For example, 3, 5 and 4 form a Pythagorean triple, since 3*3 + 4*4 = 25 = 5*5 You are given three integers, a, b, and c. They need not be given in increasing order. If they form a Pythagorean triple, then print "yes", otherwise, print "no".

13.           You are given an input N, which is a positive integer. Write a program to find the sums of fourth powers of the first N numbers. (For ex. if you input 4, output should be the sum 14+24+34+44).


No comments:

Post a Comment