5 star coder
How to become a 5 star coder

Print alternate element in an Array

Print alternate element in an Array

5 star coder

Print alternate element in an Array

Code :
#include<stdio.h>
int main(){
    int n;
    printf(“Enter size of array : “);
    scanf(“%d”,&n);
    int arr[n];
    for(int i=0;i<n;i++){
        scanf(“%d”,&arr[i]);
    }
    for(int i=0;i<n;i++){
        if(i%2==0){
        printf(“%d “,arr[i]);
        }
    }
    return 0;
}
Input :  Enter size of array : 4
                 1 2 3 4
Output :  1 3

 

Topics Covered :

  • array elements
  • c programming array
  • array in c
  • c programming for beginners

 


 

 


 

Thanks for reading this blog. Hope you get satisfied with the blog and definitely this blog must have valued your time and effort of reading.

Take a time to connect our other digital creations such as Instagram , Facebook and Youtube.

 

🧑‍💻🧑‍💻 Social Media Links of Tech DCode :

👉🏻 YouTube : https://www.youtube.com/channel/UCjJnEdeugftBwQ3yMuD4B_A
👉🏻 Instagram : https://www.instagram.com/thetechdcode/
👉🏻 Facebook Page : https://www.facebook.com/thetechdcode
👉🏻 Twitter : https://twitter.com/thetechdcode
👉🏻 Telegram Channel : https://t.me/thetechdcode
👉🏻 Tech DCode Linktree : https://linktr.ee/thetechdcode
👉🏻 My Personal Handles : https://linktr.ee/virtualshivamin

🧑‍💻🧑‍💻 Social Media Links of SHIVAM SINGH (OWNER) :

👉🏻 Instagram : https://www.instagram.com/virtualshivamin/
👉🏻 Facebook Page : https://www.facebook.com/virtualshivamin/
👉🏻 Twitter : https://twitter.com/virtualshivamin/
👉🏻 Personal Linktree : https://linktr.ee/virtualshivamin 

Leave a Reply

Your email address will not be published. Required fields are marked *