Posts

Series Printing coding 1

Image
CODE NO:- 05 Q) Write a program to display the series 0,0,2,1,4,2,6,3,8,4,………… #LOGIC According to the given series, we can conclude that : 1) At even indexes, we are having a series which starts from 0 and gets incremented by (+2). 2) At odd indexes, we are having a series which starts from 0 and gets incremented by (+1). NOTE : Here we are considering 0 as starting index. #Program  (In C++): #include<iostream> using namespace std; int main() { int i,n,a=0,b=0; cout<<"\n enter the val of n upto which you to print the series:"; cin>>n; for(i=0;i<n;i++) { if(i%2==0) { cout<<a<<" "; a+=2; } else { cout<< b<<" "; b++; } } return 0; } We got this output by using DEV C++ (IDE) Link: For other series printing problems

Pattern Printing coding 4

Image
CODE NO:- 04 Print the below pattern #LOGIC In each row first, try to print spaces then in same row print the pattern, i.e for first-row print 3 spaces then 1(required pattern). Now proceed in the same manner. #Program In    C language we use  ' // ' for single line comment #include<stdio.h> int main() { int n,i,j,k; printf("\n enter the no.of rows:"); scanf("%d",&n); for(i=0;i<n;i++) {          for(j=0;j<n-i-1;j++)// loop for printing the required spaces   { printf(" ");          }         for(k=0;k<=i;k++) // loop for printing the required pattern   { printf("%d",i+1);         } printf("\n"); } return 0; } We got this output by using DEV C++ (IDE) Link: For other pattern printing problems

Pattern Printing coding 3

Image
CODE NO:- 03 Print the below pattern #Program  (In C): #include<stdio.h> int main() { int n,i,j; printf("\n enter the no.of rows:"); scanf("%d",&n); for(i=0;i<n;i++) {         for(j=0;j<=i;j++)   {           printf("%d ",i+1);         } printf("\n"); } return 0; } We got this output by using DEV C++ (IDE)  Link: For other pattern printing problems

Pattern printing coding 2

Image
CODE NO:- 02 Print the below pattern #Program  (In C): #include<stdio.h> int main() { int n,i,j; printf("\n ent the no.of rows:"); scanf("%d",&n); for(i=0;i<n;i++) {         for(j=0;j<n;j++)   { printf("%d ",i+1);         } printf("\n"); } return 0; } We got this output by using DEV C++ (IDE)  Link: For other pattern printing problems

Pattern printing coding 1

Image
CODE NO:- 01 Print the below pattern: #Program  (In C): In   C language we use  ' // ' for single line comment #include<stdio.h>//header file int main() { int n,i,j; printf("\n enter the no.of rows:"); scanf("%d",&n); for(i=0;i<n;i++)//loop for no. of rows {         for(j=0;j<n;j++)//loop for no.of column   { printf("1 ");         }// end of inner loop printf("\n"); }// end of outer for loop return 0; }// end of main We got this output by using DEV C++ (IDE)  Link: For other pattern printing problems

WHY PROGRAMMING?

Image
                                                                                 Following are the reasons why we should learn programming : 1>"Because it makes you think". 2>"It makes you understand what technology really means ." 3>"It is just like a superpower that any hero has and can be achieved by any one of us." By programming, we can make a machine (robots etc.) to do a work what we want from them to do by just giving instructions. example-instruction given to a robot to walk.  "you need not have to be a genius  but a determinant person"                                               " programmers of today are the wiza...