Friday 29 April 2016

Solution of URI 1177 :: Array Fill II


Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.

/**Bismillahir Rahmanir Rahim.**/

#include <stdio.h>
int main()
{
    int N[1000], x, y,z;
    scanf ("%d", &x);
    for(y=0,z=0; y<1000; y++)
    {
        printf("N[%d] = %d\n",y,z);
        z++;
        if(z==x)
            z=0;
    }
    return 0;
}

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. import java.util.*;
    public class URI
    {
    public static void main(String[] args)
    {
    Scanner sc = new Scanner(System.in);
    int[] N = new int[1000];
    int T = sc.nextInt();
    int c = 0;
    int i = c;
    for( ; cT)
    {
    i = 0;
    }
    }
    for(int j = 0; j<N.length; ++j)
    {
    System.out.printf("%s%d%s%d%n","N[",j,"] = ",N[j]);
    }
    sc.close();
    }
    }


    this is my code. it shows 100% wrong answer, though it runs on java. so what could be the problem?

    ReplyDelete

Note: only a member of this blog may post a comment.