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

A bot and php command panel, Deat Sir/Madam, I need a small software .NET2...

Deat Sir/Madam, I need a small software .NET2.0 in C# That search for files by - name - extension - part of the name (contains) - file created before a date provided This search

Document type definition (dtd), What is DTD? The Document Type definiti...

What is DTD? The Document Type definition (DTD) defines how your XML should structure. For illustrate in the above XML we want to make it compulsory to provide "qty" and "total

Explain manifest, What is Manifest? Assembly metadata is keeps in Manif...

What is Manifest? Assembly metadata is keeps in Manifest. Manifest contains all the metadata required to do the following things     Version of assembly.     Security ide

Bug correction and prediction, Bug Correction and Prediction Project Des...

Bug Correction and Prediction Project Description: The project is about the prediction of bugs and resolves the bug in the sample program using costriage algorithm. You have

Elements in functions points, What are the different elements in Functions ...

What are the different elements in Functions points? 1) Internal Logical Files (ILF): Following are some points to be noted for ILF:- The ILF are logically related d

Development of app using windows phone sdk, Windows Phone 8 Player - Radio ...

Windows Phone 8 Player - Radio Live Streaming Native XAML and C# Project Description: Player for Windows Phone 8 Scope: The project evolves the development of app using

Which template is use to display data in repeater control, Which template m...

Which template must you provide, in order to display data in a Repeater control? ItemTemplate.To display data in the ItemTemplate, declare one or more Web server controls and s

Describe the roles of clr in .net framework, Describe the roles of CLR in ....

Describe the roles of CLR in .NET Framework. CLR gives an environment to execute .NET applications on target machines. CLR is also a common runtime environment for all .NET cod

Want to generate random numbers, want to generate random numbers between 1...

want to generate random numbers between 1-15 and no one should repeat until all numbers have come once....

Design develop and implement a token web application, This assignment requi...

This assignment requires you to design, develop and implement a token web application. It is intended to assess your mastery of the web application development concepts and ASP.NET

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