352,208 views
27 votes
27 votes
Write code that creates a variable called count that has the value of 102. The code then prints the value of count.

User Aravind Reddy
by
2.9k points

1 Answer

14 votes
14 votes

I'm not really sure what language you want this in but since the usual language learnt in HS in C++, I'll do it in C++ and C

In C++ :

#include <iostream>

using namespace std;

int main()

{

int count = 102;

cout << "The value of count is" << count << endl;

return 0;

}

In C:

#include <stdio.h>

int main()

{

int count = 102;

printf("The value of count is %d", count);

return 0;

}

User Hansen W
by
2.8k points