0
Program to Count and print those no which are division by 19 in range 1 to 50000 in c language
anyone know then plz post the solution
7 ответов
+ 1
it's same for both c and c++...
refer below link for more details:
https://www.includehelp.com/c/return-0-from-int-main-in-c-programming.aspx
+ 2
for(int i=19;i<=50000;i=i+19)
{
cout << i << endl;
}
This is the fastest way to get output as 19 is prime number... simple solution is as below:
for(int i=19;i<=50000;++i)
{
if(i%19==0)
{cout << i << endl; }
}
+ 2
you want all number divisible by 19 between 1 to 50000 , then only for loop is required.. otherwise check number i.e. a in if case is enough...
another thing is return type for main... it should be int rather than void
+ 1
main is the function which gets called in first... If void is the return type, one cannot return value for failure or success... Your os should get information about failure or success of ur code and that can be achieved by sending 0 or 1... c++ is designed to have this return type as int and not bool... to conclude, it's designated as int main...
0
#include<stdio.h>
#include<conio.h>
Void main()
{
Int a, i;
Printf("enter the number: ");
Scanf("%d",&a);
for( i=1;i<=50000;I++)
{
if(a%19==0)
Printf (no "%d" is division by 19 );
else
Printf ( no "%d" is not division by 19);
}
getch();
}
right or wrong
0
plz tell me the rsn of .....int main
0
m talking about c not c++