Skip to content

Instantly share code, notes, and snippets.

@JHeld07
Created March 4, 2015 04:35
Show Gist options
  • Save JHeld07/e5977dd912526e4af439 to your computer and use it in GitHub Desktop.
Save JHeld07/e5977dd912526e4af439 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <conio.h>
#include <math.h>
//Problem 3
/*
main(){
int a, b=0;
printf(" Enter an intager: ");
scanf(" %d", &a);
while(b<=10){
printf(" %d", a);
a+=1;
b++;
}
while(!kbhit()){}
}
//Proglem 4
main(){
int a=0, sum;
printf(" Enter an intager: ");
scanf(" %d", &sum);
for(a; a<=10; a++){
printf(" The sum of the next 10 numbers is %d \n", sum);
sum=sum+a;
}
printf("The sum of the next 10 numbers is %d", sum-10);
while(!kbhit()){}
}
//Problem 10
// *********NEED TO REVIEW NOT WORKING************
main(){
int a, b, c;
printf(" All numbers equal 1. Try it, enter an in greater than 0:");
scanf(" %d", a);
while(a==2||4||6||8||0){
a=a/2;
printf(" %d", a);
}
while(a==1||3||5||7||9){
a=(a*3)+1;
printf(" %d", a);
}
while(a==1){
printf("Your number is %d", a);
}
while(!kbhit()){}
}
//problem 12
main(){
int a, b;
printf(" Enter a number to factor: ");
scanf(" %d", &a);
b=a;
//for(b; b>=0; b--){
while(b>=2){
// printf("%d %d\n", a, b);
b--;
a=a*b;
// printf(" Your factor is %d\n", a);
}
printf(" Your factor is %d\n", a);
while(!kbhit()){}
}
*/
//Problem 15
main(){
int x=100;
while(x>=1){
printf(" The value of x is %d\n", x);
x=x*2;
}
while(!kbhit()){}
}
//*recreate this code using a for() Loop
//Problem 16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment