0% found this document useful (0 votes)
0 views

Programs in C

The document contains two C programs. The first program checks if a given number is a palindrome, while the second program prints a right-angled triangle using asterisks based on user input. Both programs include user prompts and utilize loops for their respective functionalities.

Uploaded by

Hemanth Atla
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Programs in C

The document contains two C programs. The first program checks if a given number is a palindrome, while the second program prints a right-angled triangle using asterisks based on user input. Both programs include user prompts and utilize loops for their respective functionalities.

Uploaded by

Hemanth Atla
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

/* Program to check whether a given number is pallindrome or not */

// Online C compiler to run C program online

#include <stdio.h>
int main() {
int num,dup;
int rev,rem;
printf("Enter a Number");
scanf("%d",&num);
dup=num;
while(dup>0)
{
rem=dup%10;
rev=rev*10+rem;
dup=dup/10;
}
if(num==rev)
printf("Pallindrome");
else
printf("Not Pallindrome");
return 0;
}

Output :
/* Program to Orint Right Angled Triangle */
// Online C compiler to run C program online
#include <stdio.h>
int main() {
int num;
int i,j;
printf("Enter Number");
scanf("%d",&num);
for(i=1;i<=num;i++)
{
for(j=1;j<=i;j++)
{
printf("* ");
}
printf("\n");
}
return 0;
}

Output :

You might also like