Answer:
Following are statement is given below
int k=1,total=0; // variable declaration
while(k<50) // iterating the while loop
{
total=total+k*k;// calculating the square
k=k+1; // increments the value of k by 1
}
Explanation:
Following are the description of Statement.
- Declared a variable "total" and "k" of the "integer " type initialized the total to 0 and "k" to 1.
- Iterating the while loop for less then 50 .In this loop, we calculating the sum of square of first 50 number in the "total" variable .
- After that increment the value of "k" variable by 1 to execute the loop less then 50 .
Answer:
#include <iostream>
using namespace std;
int main()
{
char str[100][20];
int n;
cout<<"Strings you want to enter"<<endl;
cin>>n;
cout<<"enter n strings"<<endl;
for(int i=0;i<n;i++)
cin>>str[i];
for(int i=0;i<n;i++)
{
if((int)str[i][0]==98) //ascii value b is 98
cout<<str[i]<<endl;
}
return 0;
}
Explanation:
The above written code is for printing the strings which starts with the letter b.
To check if the string starts with a letter b we are checking the ascii value 98 which corresponds to b and then printing those strings.
Answer:
import java.util.Scanner;
public class num10 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter the numbers to add up. enter 999 to stop");
int num = in.nextInt();
int sum = 0;
while (num!=999){
sum = sum+num;
System.out.println("Enter the next number");
num = in.nextInt();
}
System.out.println("The sum is: "+sum);
}
}
Explanation:
The application is implemented in Java
A while loop is used to continously prompt user for inputs. The condition of the while loop is while (num!=999)
When the number 999 is entered, it displays the sum which is initialized to 0
Answer:
true
Explanation:
so that the idiots dont die if they walk through the site
Answer:
course_class = {'CS101' : '3004', 'CS102' : '4501', 'CS103' : '6755', 'NT110' : '1244', 'CM241' : '1411'}
Explanation:
A dictionary is a data structure in python that is unordered and unindexed. It stores data in key-values pairs with each pair separated by a comma and all the items enclosed with curly braces. It is also assigned to a variable name.
The dict() function can also be used to create a dictionary variable.