Decision making and branching - c# program, DOT NET Programming

Assignment Help:

Decision Making and Branching - C# Program

Need Programming help on Decision Making and Branching in C#.


Related Discussions:- Decision making and branching - c# program

Urgently wanted a web developer, URGENTLY WANTED a Web Developer (with soli...

URGENTLY WANTED a Web Developer (with solid .NET skills) We are immediately in search of a creative passionate and highly organised expert Web Developer to join our team to work

Software development life cycles, Explain different software development li...

Explain different software development life cycles. The System Development Life Cycle (SDLC) is the overall process of developing information systems through multi stage proces

Value types and reference types, What are Value types and Reference types ...

What are Value types and Reference types The Value types directly contain their data which are either allocated on the stack or allocated in-  Line in a  structure. The Refe

We need programmers and accountants, We need programmers and accountants ...

We need programmers and accountants Skills required are .NET, C# Programming, Graphic Design, Commercials, Software Architecture

Basic methods of data adapter, What are basic methods of Data adapter? ...

What are basic methods of Data adapter? The three most commonly used methods of Dataadapter are as follows:- 1)Fill :- It Executes the SelectCommand to fill the DataSet ob

Auto trading software for nse, Project Description: Step 1: Buy 1 sha...

Project Description: Step 1: Buy 1 share at existing market price (ex: buy 1 at 100.00) If 4 points profit then close position if not go to step 2 Step 2: if 2 point

Three tier architecture, What is three tier architecture? The 3 tier so...

What is three tier architecture? The 3 tier software architecture was comes into action in the 1990s to overcome the limitations of the 2 tier architecture. There are 3 laye

Explain MVC, Explain MVC and how it is diffrennt from Asp.net

Explain MVC and how it is diffrennt from Asp.net

What is a cloud service, What is a Cloud Service? A cloud service is us...

What is a Cloud Service? A cloud service is used to build cloud applications. This service gives the facility of using the cloud application without installing it on the comput

james

2/11/2013 7:47:08 AM

This program will help you, try it out

using System;  

class SumOfOdds

{

  public static void Main()

 {

   int x=0, sumodd=0, sumeven=0, sumdiv7 = 0 ,totalno7 = 0, i;    

   for (i=0 ; i<=20 ; i++)

  {

   x = i % 2;

    if (x != 0)

   {

    sumodd = sumodd + i;

   }

    if (x == 0)

   {

    sumeven = sumeven + i;

   }

  }  

   //checking for the sum & no. of numbers divisible by 7    

  x = 0; // resetting the value of ''x''

   for (i=100; i<=200;i++)

  {

   x = i % 7;

    if (x == 0)

   {

    sumdiv7 = sumdiv7 + i;

    totalno7 = totalno7 + 1;

   }   

}     

  Console.WriteLine("Sum of all odd numbers from 1 - 20 = " + sumodd + "\n");

  Console.WriteLine("Sum of all even numbers from 1 - 20 = " + sumeven + "\n");

  Console.WriteLine("Sum of all numbers from 100 - 200, divisible by 7 = " +

sumdiv7 + "\n");

  Console.WriteLine("Total numbers from 100 - 200, divisible by 7  = " + totalno7 + "\n");

   Console.ReadLine();

 }

}

2/11/2013 7:48:14 AM

Hey John i have the ouput of above program:

Output:
Sum of all odd numbers from 1 - 20 = 100
Sum of all even numbers from 1 - 20 = 110
Sum of all numbers from 100 - 200, divisible by 7 = 2107
Total numbers from 100 - 200, divisible by 7  = 14.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd