बहार का विलोम शब्द apk facebook vfs india france rummy aser sbi दुर्घटना बीमा orbit exchange v se name girl शीत युद्ध chamd rummy nebob bedroom size in meters grahan update today hot apps list satta. matka. oppo language setting good morning sharechat rummy never 4 may 2023 panchang in hindi bed admission 2023-24 sata+mata poki game poki game सटका मटका नागपुर टीवी 100 free spins coin master अंताक्षरी इन हिंदी my 11 circle rummy app download सबसे अधिक आबादी वाला शहर giantplay best racing games for android high graphics no internet cloud game लूडो सुप्रीमो kaveri.karnataka gov.in dream 11 office in mumbai best modded apk sites 11dream.in gmail password kaise change kare slugterra dark waters sparsh meaning singam lottery app download apk elden ring mods ifms login madhya pradesh online matka play youtube to m3u converter samagra shiksha portal bhopal priceless mastercard genshin pc requirements sabse accha photo editing app hearts 247 "सामाजिक apk rush 220 पत्ती ओपन palindrome in c | Tech Blog https://www.technhit.in Technology for Mankind Tue, 16 Aug 2016 13:57:45 +0000 en-US hourly 1 https://wordpress.org/?v=5.5.3 https://i1.wp.com/www.technhit.in/wp-content/uploads/2020/10/cropped-LOGO-update2.png?fit=32%2C32&ssl=1 palindrome in c | Tech Blog https://www.technhit.in 32 32 109949773 Program using While Loop https://www.technhit.in/program-using-loop/ https://www.technhit.in/program-using-loop/#respond Thu, 11 Aug 2016 14:59:52 +0000 http://technhit.in/?p=260 Unlike most of the computer programming languages, a while loop is a control flow statement that allows code to be executed repeatedly based on a given boolean condition in C or C++. The while loop can be thought of as a repeating if statement. Here is some program using while Loop: C Program to return […]

The post Program using While Loop appeared first on Tech Blog.

]]>
Unlike most of the computer programming languages, a while loop is a control flow statement that allows code to be executed repeatedly based on a given boolean condition in C or C++. The while loop can be thought of as a repeating if statement. Here is some program using while Loop:

  • C Program to return reverse of a three digit number:

Assume that you have input a number 123 to computer and computer return it to 321. we know that if a number divided by 10 then its reminder is always the last digit of inputted number. (123%10 =3, 12%10=2)

 #include<stdio.h>
void main()
{
    int number,reverse=0,reminder;
    clrscr();
    printf("Enter any three digits value: ");
    scanf("%d",&number);
    while(number>0)
    {
         reminder=number%10;
         reverse=(reverse*10)+reminder;
         number=number/10;
    }
    printf("Reverse value is %d",reverse);

}

Output:

reverse

 

  • C Program to find Armstrong number between a range :

An Armstrong number is the  sum of the cubes of its digits and  is equal to the number itself. For example, 371 is an Armstrong number since 3**3 + 7**3 + 1**3 = 371.

 #include<stdio.h>
void main()
{
 int i=0,number, reminder, armstrong=0,term;
 clrscr();
 printf("Enter term to search Armstrong:");
 scanf("%d", &term);
 while(i<=term)
 {
 number=i;
 while(number>0)
 {
 reminder=number%10;
 armstrong =armstrong +(reminder*reminder*reminder);
 number=number/10;
 }
 if(armstrong ==i)
 printf("Armstrong No is %d",i)

 i++;
 }
}

Output:

armstrong

  • C Program to check a given number whether palindrome or not.

A palindrome is a word, phrase, number, or other sequences of characters which read the same backwards or forward. Allowances may be made for adjustments to capital letters, punctuation, and word dividers. Examples in English include “A man, a plan, a canal, Panama!”, “Amor, Roma”, “race car”, “stack cats”, “step on no pets”, “taco cat”, “put it up”, “Was it a car or a cat I saw?” and “No ‘x’ in Nixon” ,”121″ etc.

In case of number we use reverse method:

 #include<stdio.h>
void main()
{
   int num,value,reminder,tmp;
   printf("Enter any number to check palindrome");
   scanf("%d",&num);
   tmp=num;
   while(tmp>0)
   {
      reminder=tmp%10;
      value=value*10+reminder;
      tmp=tmp/10;

   }
   if (num==value)
   {
     printf("Entered Number %d is a palidrome number",num);
   }
   else
   {
     printf("Entered Number %d is not apalindrome number",num);
   }
}

In case of String we use string function substr()

 #include<stdio.h>
#include<string.h>
void main()
{
 char word[100],rev[100];
 clrscr();
 printf("Enter any word: ");
 scanf("%s", &word);
 strcpy(rev,word);
 if (strcmp(word,strrev(rev))==0)
 {
 printf("The word is palindrome");
 }
 else
 {
 printf("The word is not a palindrome");
 }
 getch();

}

palindrom

The post Program using While Loop appeared first on Tech Blog.

]]>
https://www.technhit.in/program-using-loop/feed/ 0 260