Lab Assignment 4
Lab Assignment 4
Course-BTech(CSE)
Roll No.-24155589
#include <stdio.h>
int main() INPUT:
{ Enter the number=5
int a;
printf("Enter the number=");
scanf("%d",&a);
while(a>=1)
{
printf("%d\t",a);
a=a-1;
OUTPUT:
} 54321
return 0;
}
Question4)WAP to take 10 different numbers as input. Print their sum and average.
#include <stdio.h>
int main()
{
int a,s,l;
INPUT:
s=0; Enter the number=234
printf("Enter the number=");
scanf("%d",&a);
while(a>0)
{
l=a%10;
s+=l;
a=a/10; OUTPUT:
} The sum is 9
printf("The sum is %d",s);
return 0;
}
Question 6)WAP to find out the reverse of a number.
INPUT:
#include <stdio.h> Enter the number=634
int main()
{
int a,n;
printf("Enter the number=");
scanf("%d",&a);
while(a>0) OUTPUT:
{
n=a%10; 436
printf("%d",n);
a=a/10;
}
return 0;
}