Previous H/W questions

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

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.

 


  

    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);
    }
}

Write a program to print the following patterns.

Question:1

 

Input :

5

Output :

*****
*****                                    
*****                                
*****                              
*****                             

Question:2

 

Input :

5

Output :

 

*
**                                  
***                              
****                            
*****                             

Question:3

 

                                        *
                                      **
                                    ***
                                  ****
                                *****

Question:4

 

                             1

                             22

                             333

                             4444

                             55555          

Question:5

 

                             1

                             12

                             123

                             1234

                             12345          

Question:6

           

             4 3 2 1        
             3 2 1                 
             2 1                 
             1                

Question:7

           

                         1 
                       0 1        
                     1 0 1      
                   0 1 0 1    

Copy of deck

By sandeep chauhan

Copy of deck

  • 559