Computer Science, asked by fahimkhan40226, 4 months ago

Write a program (WAP) that will print following series upto Nth terms.
1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, …….
input: 4
output : 1, 0, 1, 0
must need to be solved in c programing

Answers

Answered by ashiqur353162
11

Answer:

#include<stdio.h>

int main(){

   int i, j, n;

   printf("Enter a value: ");

   scanf("%d", &n);

   for(i=1; i<=n; i++)  {

      int r;

      for(j=1; j<=i; j++)   {

           r = j%2;

       }

       printf("%d, ", r);

   }

   return 0;

}

Similar questions