C++ Prog Assignmnt
C++ Prog Assignmnt
#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
for (int i=1;i<=300;i++)
{
for(int j=2;j<=i;j++)
if(i%j==0 )
break;
else
{
printf("\t%d ",i);
break;
}
}
getche();
}
#include <iostream.h>
total = 0.0;
return 0;
}
Write a Velocity Program
#include<stdio.h>
#include<math.h>
int main (void)
{
int time,velocity, acceleration;
printf ("Please input time in seconds: \n");
scanf_s("%d" , &time);
velocity = 0.00001* pow(time,3)-.00488* pow (time,2)+.75795*time+181.3566;
acceleration = 3-0.000062*pow(velocity,2);
printf ("Velocity: ""%d\n",velocity);
printf ("Acceleration: ""%d\n",acceleration);
return 0;
#include<stdio.h>
#include<math.h>
int main (void)
{
int time,<strong class="highlight">velocity</strong>, acceleration;
printf ("Please input time in seconds: \n");
scanf_s("%d" , &time);
<strong class="highlight">velocity</strong> = 0.00001* pow(time,3)-.00488* pow
(time,2)+.75795*time+181.3566;
acceleration = 3-0.000062*pow(<strong class="highlight">velocity</strong>,2);
printf ("<strong class="highlight">Velocity</strong>: ""%d\n",<strong
class="highlight">velocity</strong>);
printf ("Acceleration: ""%d\n",acceleration);
return 0;
#include <iostream>
#define EXIT -99
#define CONTINUE 1
using namespace std;
int smallest, largest, current;
int main() {
while (true) {
loop:
cout << "Number: ";
cin >> current;
if (current == EXIT) break;
smallest <?= current;
largest >?= current;
}
cout << "Smallest: " << smallest << endl;
cout << "Largest: " << largest << endl;
cout << "1 to continue, anything else to bugger off" << endl;
cin >> current;
if (current == CONTINUE) goto loop;
return(0);
}