PPS Assignment
PPS Assignment
ROLL NO.-200151520010
BRANCH-ECE
2nd SEMESTER
#include<stdio.h>
int main()
{
int n,r,s=0,rev=0;
printf("Enter a number:");
scanf("%d",&n);
while(n!=0)
{
r=n%10;
s=s+r;
rev=rev*10+r;
n=n/10;
}
printf("Sum of digits:%d\n",s);
printf("Reverse of the number is:%d",rev);
}
Example output screen-
NAME-DEEPANSHI
ROLL NO.-200151520010
BRANCH-ECE
2nd SEMESTER
int main()
{
int a,b,c;
a=9;
b=83;
c=sum(a,b);
printf("Sum is:%d",c);
return 0;
}
#include<stdio.h>
void swap(int *x,int *y)
{
int temp;
temp=*x;
*x=*y;
*y=temp;
}
int main()
{
int a=30,b=70;
printf("%d and %d\n",a,b);
swap(&a,&b);
printf("%d and %d\n",a,b);
return 0;
}
Example output screen-