Here this article I would like to share with you a very simple program that I wrote using C# as my programming language that will ask the user to give a number and then our program will generate the list of odd number based on the given number by our user. I hope you will find my work useful in learning how to program in C#. Thank you.
Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
Sample Program Output
Program Listing
odd.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace multiplication_table
{
class multiplication_table
{
/* Program : Find Odd Numbers */
/* Author : Mr. Jake R. Pomperada, MAED-IT */
/* Date : Noverber 24, 2016 Thursday 10:12 AM */
/* Tools : C# */
static void Main(string[] args)
{
int num = 0;
Console.Write("\n\n");
Console.Write(" ===== FIND ODD NUMBERS ===== ");
Console.Write("\n\n");
Console.Write("Give a Number : ");
num= int.Parse(Console.ReadLine());
Console.Write("\n");
Console.Write("\t ===== LIST OF ODD NUMBERS ===== ");
Console.Write("\n\n");
for (int a = 0; a <= num; a++)
{
if (a % 2 !=0)
{
Console.Write(" {0} ",a);
}
}
Console.Write("\n\n");
Console.Write("\t End of Program ");
Console.Write("\n\n");
Console.ReadLine();
}
}
}
No comments:
Post a Comment