Professional Documents
Culture Documents
Week 01 - Assignments CSE115 (SAM)
Week 01 - Assignments CSE115 (SAM)
Week 01 - Assignments CSE115 (SAM)
h>
int main()
{
int a,b,c,d,f;
b = a * 1000;
c = b * 3.28;
d = c * 12;
f = d * 30;
getch ();
return 0;
}
2. #include <stdio.h>
#include <conio.h>
void main()
{
float c,f;
printf("Fahrebheit Temperature = ");
scanf("%f",&f);
c=(f-32)*5/9;
printf("\nCelcius Temperature = %f",c);
getch();
}
3. #include<stdio.h>
int main()
{
int a,b,area_r,area_c,peri_r,peri_c,r;
printf ("Enter length and width of rectangle: ");
scanf ("%d%d",&a,&b);
area_r = (a * b);
peri_r = ((2*a) + (2*b));
getch ();
return 0;
}
4. #include<stdio.h>
void main()
{
Int c,d,e;
Clrscr();
Printf(“\nEnter the number at locations C:”);
Scanf(“%d”,&c);
Printf(“\nEnter the number at locations D:”)
Scanf(“%d”,&d);
e=c;
c=d;
d=e;
Printf(“\nNew number at locations C=%d”,c);
Printf(“\nNew number at locations D=%d”,d);
Printf(“\n\n\n\n\nPress any key to exit”);
Getch();
}
5. #include <stdio.h>
#include <conio.h>
void main()
int num, a, n;
int sum = 0;
clrscr();
scanf("%d", &num);
a = num % 10;
n = num/10;
sum = sum + a;
a=n%10;
n=n/l0;
sum = sum + a;
a=n%10;
n=n/l0;
sum = sum + a;
a=n%10;
n=n/l0;
sum = sum + a;
a=n%10;
sum = sum + a;
getch();
}
6. #include <stdio.h>
int main()
{
int n, reverse = 0;
printf("Enter a number to reverse\n");
scanf("%d", &n);
while (n != 0)
{
reverse = reverse * 10;
reverse = reverse + n%10;
n = n/10;
}
printf("Reverse of entered number is =
%d\n", reverse);
return 0;
}
7.#include<stdio.h>
#include<conio.h>
void main()
int n, a, sum = 0;
clrscr();
scanf("%d", &n);
a = n/1000;
sum = sum + a;
a=n%10;
sum=sum+a;
getch();
}
8. #include<conio.h>
#include<stdio.h>
int main()
{
float cost, sale, costitem, profit;
printf("\nCost price per item:
%f",costitem);
getche();
}
10.
a)
b)
c)
d)
e)
f)