URI Online Judge Solution 1070 Six Odd Numbers - Solution in C, C++, Java, Python and C#
URI Online Judge Solution 1070 Six Odd Numbers | BeginnerURI Problem Link - https://www.urionlinejudge.com.br/judge/en/problems/view/1070
Problem Name: 1070 Six Odd Numbers solution
Problem Number : URI - 1070 Six Odd Numbers code
Online Judge : URI Online Judge Solution
Category: Beginner
Solution Language : C,C plus plus, java, python, c#(c sharp)
URI 1070 Six Odd Numbers Code in C / URI 1070 Six Odd Numbers solution in C:
#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; }
Run URI 1070 code in live Jdoodle code editor and see the result:
Please give the above input to see the live result in the StdIn input box of Jdoodle:Input Sample | Output Sample |
8 | 9 11 13 15 17 19 |
URI 1070 Six Odd Numbers Code in C++ / URI 1070 Six Odd Numbers solution in CPP:
#include <iostream> using namespace std; int main() { int x, tmp = 0; bool ver = false; cin >> x; while(ver == false) { if(x % 2 == 1){ cout << x << endl; tmp++; } if(tmp == 6) return 0; x++; } return 0; }
URI 1070 Six Odd Numbers Code in java/ URI 1070 Six Odd Numbers solution in Java:
import java.util.*; public class Main { public static void main(String args[]) { int i, X, howManyOdd = 6; Scanner input = new Scanner(System.in); X = input.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); } } } }
Run URI 1070 java code in live Jdoodle Text editor:
Please give input as 8,
URI 1070 Six Odd Numbers Code in Python / URI 1070 Six Odd Numbers solution in Python:
URI Solution 1070 Six Odd Numbers Code / URI 1070 Six Odd Numbers solution in C# (C Sharp):
Demonstration:
Just implement this in coding. Since having any problem just put a comment below. Thanks
Tags: URI Online Judge Solution, URI OJ Solution list, URI Problems Solution, URI solver, URI all problem solution list, URI 1070 Six Odd Numbers code in C, URI 1070 Six Odd Numbers code in C++, URI Area of a circle solution in C, URI solution, URI 1070 solution in C,URI 1070 solution in C++-CPP,URI 1070 Six Odd Numbers solution in C# (C sharp),URI 1070 Six Odd Numbers solution in Java,URI 1070 solution in Python,
No comments:
Post a Comment