0
how to write a c program to display all 2 digit number whose sum of them is 5?
6 Respuestas
+ 3
narthana wickramasinghe
It can be done in multiple ways but you should try first. And then show your attempt then we can help you.
+ 1
This is my attempt can you correct that
0
#include<stdio.h>
int main()
{
int n,sum=1;
for(n=1;n<=5;n++){
sum=sum+n;
}
while(sum==5){
printf("%d",n);
}
}
0
narthana wickramasinghe
this what I understand from your question
for(n=10;n<=50;n++)
{
dup = n;
f_digit= dup%10;
dup = dup/10;
l_digit= dup%10;
if ( f_digit + l_digit == 5)
printf("%d\n",n);
}
0
Okkkk thankzzz