Lab Work
Lab Work
#include<stdio.h>
int main(){
int num1=0;
int sum =0;
printf("\n");
/*
while (num1 < 10)
{
printf("%d\n",num1+1 );
num1 = num1 + 1;
sum= num1+sum;
} printf("the sum is %d",sum);
*/
2
do
{
int num1=1;
/* code */
num1 = num1 ;
sum = sum + num1;
printf("%d\n",num1);
}
while (num1 < 10);
printf("the sum isfor do while %d",sum);
return 0;
}
3
#include<stdio.h>
int main(){
/*find theh sum of 9+11+13+15-----+57+59 */
int count=9;
int sum=0;
while(count<=59){
sum=sum+count;
count=count+2;
}
printf("the sum for the while %d\n",sum);
printf("\n");
4
do
{
sum=sum+count;
count=count+2;
} while (count<=59);
printf(" the sum for the do while %d",sum);
return 0;
}
5
#include <stdio.h>
int main() {
int lower;
int upper;
int counter;
int squr;
return 0;
}
6
#include<stdio.h>
int main(){
//find the largest number after get 10 numbers from the user
int largest,count,num;
count = 0;
if (num> largest)
{
largest= num;
}
}
printf("largest is %d",largest);
return 0;
}