Answer to Question #262563 in C++ for kjhg

Question #262563

Write a C# application that asks the user to input ‘A’ and ‘B’ and prints the sum of squares of all odd numbers between ‘A’ and ‘B’. 


1
Expert's answer
2021-11-07T17:18:31-0500
Using system;
namespace Example1{
class program{
    public static void public static void Main(string[] args)
    {
        int A,B,sum=0;
        Console.WriteLine("Enter the first number:");
        A=Console.ToInt32(readLine());
        Console.WriteLine("Enter the second number:");
        B=Console.ToInt32(readLine());
        for(int i=A;i<=B;i++){
            if(i%2==1){
         sum=sum+pow(i,2);
         }
        }
        Console.WriteLine("sum of squares of all odd numbers between a and b"+)


    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS