URI Online Judge | 1070
Six Odd Numbers
URI 1070 solution in java language || Six odd numbers:
import java.io.IOException; import java.util.Scanner; public class Main{ public static void main(String[] args) throws IOException{ Scanner sc = new Scanner(System.in); int i, X, howManyOdd = 6; X = sc.nextInt(); for( i = X; i < (X+(howManyOdd*2)) ; i+=2){ int odd; if(i % 2 == 0){ odd = i + 1; System.out.printf("%d\n", odd); }else{ odd = i; System.out.printf("%d\n", odd); } } } }
URI 1070 Solution in C language | Six odd Number's solution:
#include <stdio.h> int main(){ int i, X, howManyOdd = 6; scanf("%d", &X); for( i = X; i < (X+(howManyOdd*2)) ; i+=2){ int odd; if(i % 2 == 0){ odd = i + 1; printf("%d\n", odd); }else{ odd = i; printf("%d\n", odd); } } return 0; }
Tags: URI 1070 solution in C, URI online judge solution, URI solution 1070 in java
[Update : May 25 2017 -> After getting a comment from Gk Polash]
No comments:
Write commentsTo know more about the problem, give us your valuable commment. We'll try to help you. Thanks