Message from C, C++ discussions

December 2019

— For every cin and cout??

— 

#include <stdio.h>

//Compiler version gcc 6.3.0

int main()
{
int i, sum=0;
printf("Numbers between A and B, divisible by 3 : \n");

printf ("input A");
scanf "A";
printf ("input B");
scanf "B";

{
if(i%3==0)
{
printf("% 5d",i);

}
}
printf("%d \n");
}

— Yes, for everything in the STL. It's not that bad once you get used to it

— What is wrong here?

— I will practice it from now onwards

— How to write this code so that you can enter A and B so that it finds a multiple of 3 from A to B?

— Guys help plz

— Https://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice
You can refer to this for the topic.

Message permanent page

— What should scanf "A"; do in your opinion, and how should it be compiled?

— Http://www.cplusplus.com/reference/cstdio/scanf/
Check this for how to use scanf function.

— 👍

— #include <stdio.h>

//Compiler version gcc 6.3.0

int main()
{
int i, sum=0,A,B;
printf ("input A : ");
scanf ("%d",&A);
printf ("input B : ");
scanf ("%d",&B);
printf("Numbers between A and B, divisible by 3 : \n");
for(i=A;i<B;i++)
{
if(i%3==0)
{
printf("%d",i);
printf(" ");
}
}
}

Message permanent page