Quiz 1 programming fundamental-1

why is short double Nagarro is invalid?

Hi akshat, there are several restrictions where they are defined as


Here, you can understand where we can use data modifiers & with whom…

If you still have doubt, please feel free to ask again…!!

sir means double is not a data modifier but a data type.

No, Double is a data modifier but it can not be used with “short”

NOTE:- Only long modifier is allowed in double data types. We cant use any other specifier with double data type. If we try any other specifier, compiler will give compile time error.

Please try the same example given in the quiz with “long” i.e. “long double Nagarrow”
So that, it will become more clearer to you.

1 Like

thank u so much sir.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

sir will u please assist me that where is the fault in my code that is not working after the n=10

#include
using namespace std;
int main() {
long int n,i=2;
cout<<“Enter the number to be checked that the number is prime or not”<<endl;
cin>>n;
if(n==1)
{
cout<<“Its not a prime number”;
}
while(i<n)
{
if(n%i==0)
cout<<“the given number is not a prime.”;
break;
i++;
}
if(i==n-1)
cout<<“Given number is prime.”;
return 0;

}

sir i didn’t exactly understand that where to use for loop and where to use the while loop.
please guide me.

cout<<c=a+b<<" ";
is it inavlid?

Hi Akshat, Please make sure for the next time you will post code on the IDE & save it and then share it that URL.

Here, you have a plenty of mistakes

  1. If you want to increase INT capacity with the help of LONG identifiers. you have to use "long long int " not “long int”
  2. “1” is not a prime number but there is no need to mention that.
  3. We can not conclude whether it is prime or not without coming out of the loop
  4. Please use { } brackets for the sake of good practice.

In WHILE loop, you have to follow 3 steps for every loop situation:

  1. Initialization
  2. Condition check
  3. Update

For every situation, you can use any loop.

(c=a+b) --> this is assigning a value
and,
COUT is basically used to print a particular value.